-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/// <reference path="../../definitions/typescript-node-definitions/winston.d.ts"/> | ||
|
||
import scrap = require("./CheerioScraper"); | ||
import song = require("../../Song"); | ||
|
||
import winston = require("winston"); | ||
|
||
export class GensokyoRadioScraper extends scrap.CheerioScraper { | ||
|
||
constructor(name:string) { | ||
super(name); | ||
this.xmlMode = true; | ||
} | ||
|
||
getUrl(scraperParam?:string): string { | ||
return "https://gensokyoradio.net/xml/"; | ||
} | ||
|
||
public parseCheerio($:any, callback:(err, newNowPlayingSong:song.Song, justScrobbledSong?:song.Song) => void):void { | ||
var titleElem = $('GENSOKYORADIODATA SONGINFO TITLE'); | ||
var artistElem = $('GENSOKYORADIODATA SONGINFO ARTIST'); | ||
|
||
if (titleElem.length < 1 || artistElem.length < 1) { | ||
callback(null, { Artist: null, Track: null }, null); | ||
return; | ||
} | ||
|
||
|
||
var track = titleElem.eq(0).text().trim(); | ||
var artist = artistElem.eq(0).text().trim(); | ||
|
||
callback(null, { Artist: artist, Track: track }, null); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference path="../../definitions/typescript-node-definitions/winston.d.ts"/> | ||
|
||
import song = require("../../Song"); | ||
import jsonScrap = require("./JsonScraper"); | ||
|
||
import winston = require("winston"); | ||
|
||
export class Los40Scraper extends jsonScrap.JsonScraper { | ||
|
||
constructor(name:string) { | ||
super(name); | ||
} | ||
|
||
getUrl(): string { | ||
return "http://www.yes.fm/a/radio/fm/hasonado/LOS40"; | ||
} | ||
|
||
extractNowPlayingSong(jsonData:any): song.Song { | ||
return { Artist: jsonData.result[0].artist, Track: jsonData.result[0].track }; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// <reference path="../../definitions/typescript-node-definitions/winston.d.ts"/> | ||
|
||
import song = require("../../Song"); | ||
import jsonScrap = require("./JsonScraper"); | ||
|
||
import winston = require("winston"); | ||
|
||
export class RadioUScraper extends jsonScrap.JsonScraper { | ||
|
||
constructor(name:string) { | ||
super(name); | ||
} | ||
|
||
getUrl(): string { | ||
return "http://cc.net2streams.com/external/rpc.php?m=streaminfo.get&username=live&rid=live&_=" + new Date().getTime(); | ||
} | ||
|
||
extractNowPlayingSong(jsonData:any): song.Song { | ||
if (jsonData.data[0].track.artist === "Unknown") { | ||
return { Artist: null, Track: null }; | ||
} | ||
return { Artist: jsonData.data[0].track.artist, Track: jsonData.data[0].track.title }; | ||
} | ||
} |