Skip to content

Commit

Permalink
Fixed Fusion and ABCJazz scrapers.
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnici committed May 31, 2015
1 parent a5e3213 commit 8009fb5
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ var scrapers:{ [index: string]: scrap.Scraper; } = {
DoubleJ: new doubleJ.DoubleJScraper("DoubleJ"),
WZBC: new wzbc.WzbcScraper("WZBC"),
PlayFM: new janus.JanusScraper("PlayFM", "playfm"),
ABCJazz: new digMusic.DigMusicScraper("ABCJazz", "http://abcjazz.net.au/player-data.php"),
ABCJazz: new doubleJ.DoubleJScraper("ABCJazz", "http://music.abcradio.net.au/api/v1/plays/jazz/now.json"),
TheCurrent: new theCurrent.TheCurrentScraper("TheCurrent"),
LastFM: new lfmScraper.LastfmScraper("LastFM", LASTFM_API_KEY),
LastFMIgnoreListening: new lfmNoNowPlayingScraper.LastfmNoNowPlayingScraper("LastFMIgnoreListening", LASTFM_API_KEY),
Expand Down
14 changes: 10 additions & 4 deletions scrapers/cheerio/FusionScraper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scrapers/cheerio/FusionScraper.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions scrapers/cheerio/FusionScraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,26 @@ export class FusionScraper extends scrap.CheerioScraper {
}

getUrl(scraperParam?:string): string {
return "http://load.fusion.fm/" + scraperParam + "/title/nowplaying.php";
return "http://load.nexusradio.fm/" + scraperParam + "/title/nowplaying.php";
}

public parseCheerio($:any, callback:(err, newNowPlayingSong:song.Song, justScrobbledSong?:song.Song) => void):void {
var divs = $('body div div');

if (divs.length < 2) {
if (divs.length < 1) {
callback(null, { Artist: null, Track: null });
return;
}

var track = divs.eq(0).text().trim();
var artist = divs.eq(1).text().trim();
var trackAndArtist = divs.eq(0).text().trim();
var dashIndex = trackAndArtist.indexOf("-");
if (dashIndex < 0) {
callback(null, { Artist: null, Track: null });
return;
}

var track = trackAndArtist.substring(0,dashIndex).trim();
var artist = trackAndArtist.substring(dashIndex + 1).trim();

callback(null, { Artist: artist, Track: track });
}
Expand Down
4 changes: 2 additions & 2 deletions scrapers/json/DoubleJScraper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scrapers/json/DoubleJScraper.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scrapers/json/DoubleJScraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import winston = require("winston");
export class DoubleJScraper extends scrap.JsonScraper {
private url: string;

constructor(name:string) {
constructor(name:string, url?:string) {
super(name);
this.url = "http://music.abcradio.net.au/api/v1/plays/doublej/now.json";
this.url = url || "http://music.abcradio.net.au/api/v1/plays/doublej/now.json";
}

getUrl(lastfmUsername?:string): string {
Expand Down

0 comments on commit 8009fb5

Please sign in to comment.