From ae769515ab21e3bf35a5a77dd701b8c2bd854a1c Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 15:54:00 -0500 Subject: [PATCH 01/13] Added R&B --- src/constants/Constants.js | 7 ++++++- src/constants/Constants.js~ | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/constants/Constants.js~ diff --git a/src/constants/Constants.js b/src/constants/Constants.js index eaac937..47ae2ad 100644 --- a/src/constants/Constants.js +++ b/src/constants/Constants.js @@ -10,8 +10,13 @@ var Type2URLs = { "base_url":"http://rapgenius.com", "search_url":"http://rapgenius.com/search", "annotations_url": "http://rapgenius.com/annotations/for_song_page" + }, + "r-b": { + "artist_url":"http://r-b.genius.com/artists/", + "base_url": "http://r-b.genius.com", + "search_url": "http://r-b.genius.com/search", + "annotations_url": "http://r-b.genius.com/annotations/for_song_page" } - }; module.exports.Type2URLs = Type2URLs; diff --git a/src/constants/Constants.js~ b/src/constants/Constants.js~ new file mode 100644 index 0000000..eaac937 --- /dev/null +++ b/src/constants/Constants.js~ @@ -0,0 +1,25 @@ +var Type2URLs = { + "rock": { + "artist_url":"http://rock.rapgenius.com/artists/", + "base_url":"http://rock.rapgenius.com", + "search_url":"http://rock.rapgenius.com/search", + "annotations_url": "http://rock.rapgenius.com/annotations/for_song_page" + }, + "rap": { + "artist_url":"http://rapgenius.com/artists/", + "base_url":"http://rapgenius.com", + "search_url":"http://rapgenius.com/search", + "annotations_url": "http://rapgenius.com/annotations/for_song_page" + } + +}; + +module.exports.Type2URLs = Type2URLs; + +module.exports.ROCK_RAP_GENIUS_URL = "http://rock.rapgenius.com"; +module.exports.ROCK_RAP_GENIUS_URL_SEARCH_URL = "http://rock.rapgenius.com/search"; +module.exports.ROCK_RAP_GENIUS_ARTIST_URL = "http://rock.rapgenius.com/artists/"; + +module.exports.RAP_GENIUS_URL = "http://rapgenius.com"; +module.exports.RAP_GENIUS_URL_SEARCH_URL = "http://rapgenius.com/search"; +module.exports.RAP_GENIUS_ARTIST_URL = "http://rapgenius.com/artists/"; From 2d6b8ab2f4e7de4ce18633215663700e27cb3a69 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 19:00:45 -0500 Subject: [PATCH 02/13] Added R-B Elsewhere --- src/constants/Constants.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/constants/Constants.js b/src/constants/Constants.js index 47ae2ad..173a368 100644 --- a/src/constants/Constants.js +++ b/src/constants/Constants.js @@ -12,10 +12,10 @@ var Type2URLs = { "annotations_url": "http://rapgenius.com/annotations/for_song_page" }, "r-b": { - "artist_url":"http://r-b.genius.com/artists/", - "base_url": "http://r-b.genius.com", - "search_url": "http://r-b.genius.com/search", - "annotations_url": "http://r-b.genius.com/annotations/for_song_page" + "artist_url":"http://r-b.genius.com/artists/", + "base_url": "http://r-b.genius.com", + "search_url": "http://r-b.genius.com/search", + "annotations_url": "http://r-b.genius.com/annotations/for_song_page" } }; @@ -28,3 +28,7 @@ module.exports.ROCK_RAP_GENIUS_ARTIST_URL = "http://rock.rapgenius.com/artists/" module.exports.RAP_GENIUS_URL = "http://rapgenius.com"; module.exports.RAP_GENIUS_URL_SEARCH_URL = "http://rapgenius.com/search"; module.exports.RAP_GENIUS_ARTIST_URL = "http://rapgenius.com/artists/"; + +module.exports.RB_RAP_GENIUS_URL = "http://r-b.genius.com"; +module.exports.RB_RAP_GENIUS_URL_SEARCH_URL = "http://r-b.genius.com/search"; +module.exports.RB_RAP_GENIUS_ARTIST_URL = "http://r-b.genius.com/artists/"; From 7f6a7e990685168683b557999dffefeedb1318b7 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 19:50:43 -0500 Subject: [PATCH 03/13] Changed package.json --- genius_api_lyrics.js | 33 +++++++++++++++++++++++++++++++++ package.json | 4 ++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 genius_api_lyrics.js diff --git a/genius_api_lyrics.js b/genius_api_lyrics.js new file mode 100644 index 0000000..a57f80c --- /dev/null +++ b/genius_api_lyrics.js @@ -0,0 +1,33 @@ +var rapgeniusClient = require("rapgenius-js"); + +var lyricsSearchCb = function(err, lyricsAndExplanations){ + if(err){ + console.log("Error: " + err); + }else{ + //Printing lyrics with section names + var lyrics = lyricsAndExplanations.lyrics; + var explanations = lyricsAndExplanations.explanations; + console.log("Found lyrics for song [title=%s, main-artist=%s, featuring-artists=%s, producing-artists=%s]", + lyrics.songTitle, lyrics.mainArtist, lyrics.featuringArtists, lyrics.producingArtists); + //console.log("**** LYRICS *****\n%s", lyrics.getFullLyrics(true)); + + //Now we can embed the explanations within the verses + lyrics.addExplanations(explanations); + var firstVerses = lyrics.sections[0].verses[0]; + console.log(firstVerses.content.split('\n')[0]); + //console.log("\nVerses:\n %s \n\n *** This means ***\n%s", firstVerses.content, firstVerses.explanation); + } +}; + +var searchCallback = function(err, songs){ + if(err){ + console.log("Error: " + err); + }else{ + if(songs.length > 0){ + //We have some songs + rapgeniusClient.searchLyricsAndExplanations(songs[0].link, "r&b", lyricsSearchCb); + } + } +}; + +rapgeniusClient.searchSong("Drunk in Love", "r-b", searchCallback); \ No newline at end of file diff --git a/package.json b/package.json index 970bb46..fdd20cc 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "rapgenius-js", "description": "A client that queries the RapGenius (www.rapgenius.com) website", - "version": "0.1.2", + "rapgenius-js": "https://github.com/yuichitlo/RapGenius-JS/tarball/master", "keywords": ["rap", "rock", "rapgenius", "client", "lyrics", "music"], "author": "kenshiro-o", "main": "src/geniusClient", "repository": { "type": "git", - "url": "git://github.com/kenshiro-o/RapGenius-JS.git" + "url": "git://github.com/yuichitlo/RapGenius-JS.git" }, "dependencies": { "superagent": "0.12.x", From e570ea6e48144881b13a13f456829aa5e3129b7d Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 19:55:54 -0500 Subject: [PATCH 04/13] Attempt 2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdd20cc..f480085 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rapgenius-js", + "name": "genius-js", "description": "A client that queries the RapGenius (www.rapgenius.com) website", "rapgenius-js": "https://github.com/yuichitlo/RapGenius-JS/tarball/master", "keywords": ["rap", "rock", "rapgenius", "client", "lyrics", "music"], From 53fe819e40144d49a2ea63e2c8e9eefd924fb32b Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 20:01:02 -0500 Subject: [PATCH 05/13] Attempt 3 --- npm-debug.log | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 118 insertions(+) create mode 100644 npm-debug.log diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..9d67db2 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,117 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'node', +1 verbose cli '/usr/local/bin/npm', +1 verbose cli 'install', +1 verbose cli 'https://github.com/yuichitlo/RapGenius-JS/tarball/master' ] +2 info using npm@2.5.1 +3 info using node@v0.12.0 +4 silly cache add args [ 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', +4 silly cache add null ] +5 verbose cache add spec https://github.com/yuichitlo/RapGenius-JS/tarball/master +6 silly cache add parsed spec { raw: 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', +6 silly cache add scope: null, +6 silly cache add name: null, +6 silly cache add rawSpec: 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', +6 silly cache add spec: 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', +6 silly cache add type: 'remote' } +7 silly mapToRegistry name https://github.com/yuichitlo/RapGenius-JS/tarball/master +8 silly mapToRegistry using default registry +9 silly mapToRegistry registry https://registry.npmjs.org/ +10 silly mapToRegistry uri https://github.com/yuichitlo/RapGenius-JS/tarball/master +11 verbose addRemoteTarball https://github.com/yuichitlo/RapGenius-JS/tarball/master not in flight; adding +12 verbose addRemoteTarball [ 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', +12 verbose addRemoteTarball null ] +13 info retry fetch attempt 1 at 7:58:26 PM +14 info attempt registry request try #1 at 7:58:26 PM +15 http fetch GET https://github.com/yuichitlo/RapGenius-JS/tarball/master +16 verbose request id f0f242b6f2498202 +17 http fetch 200 https://github.com/yuichitlo/RapGenius-JS/tarball/master +18 silly fetchAndShaCheck shasum 186a56fec17643e6023fe4773cfa2f2df70199d6 +19 verbose addTmpTarball /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/github.com/yuichitlo/RapGenius-JS/tarball/master not in flight; adding +20 verbose addTmpTarball validating metadata from /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/github.com/yuichitlo/RapGenius-JS/tarball/master +21 verbose tar unpack /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/github.com/yuichitlo/RapGenius-JS/tarball/master +22 verbose tar unpacking to /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/unpack-6bebba7b9f3c +23 verbose gentlyRm vacuuming /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/unpack-6bebba7b9f3c +24 silly gunzTarPerm modes [ '755', '644' ] +25 silly gunzTarPerm extractEntry +26 silly gunzTarPerm modified mode [ '', 509, 493 ] +27 silly gunzTarPerm extractEntry .gitignore +28 silly gunzTarPerm modified mode [ '.gitignore', 436, 420 ] +29 silly gunzTarPerm extractEntry .npmignore +30 silly gunzTarPerm modified mode [ '.npmignore', 436, 420 ] +31 silly gunzTarPerm extractEntry .travis.yml +32 silly gunzTarPerm modified mode [ '.travis.yml', 436, 420 ] +33 silly gunzTarPerm extractEntry History.md +34 silly gunzTarPerm modified mode [ 'History.md', 436, 420 ] +35 silly gunzTarPerm extractEntry Makefile +36 silly gunzTarPerm modified mode [ 'Makefile', 436, 420 ] +37 silly gunzTarPerm extractEntry README.md +38 silly gunzTarPerm modified mode [ 'README.md', 436, 420 ] +39 silly gunzTarPerm extractEntry examples/ +40 silly gunzTarPerm modified mode [ 'examples/', 509, 493 ] +41 silly gunzTarPerm extractEntry examples/artistSearch.js +42 silly gunzTarPerm modified mode [ 'examples/artistSearch.js', 436, 420 ] +43 silly gunzTarPerm extractEntry examples/lyricsSearch.js +44 silly gunzTarPerm modified mode [ 'examples/lyricsSearch.js', 436, 420 ] +45 silly gunzTarPerm extractEntry examples/songSearch.js +46 silly gunzTarPerm modified mode [ 'examples/songSearch.js', 436, 420 ] +47 silly gunzTarPerm extractEntry genius_api_lyrics.js +48 silly gunzTarPerm modified mode [ 'genius_api_lyrics.js', 436, 420 ] +49 silly gunzTarPerm extractEntry package.json +50 silly gunzTarPerm modified mode [ 'package.json', 436, 420 ] +51 silly gunzTarPerm extractEntry src/ +52 silly gunzTarPerm modified mode [ 'src/', 509, 493 ] +53 silly gunzTarPerm extractEntry src/constants/ +54 silly gunzTarPerm modified mode [ 'src/constants/', 509, 493 ] +55 silly gunzTarPerm extractEntry src/constants/Constants.js +56 silly gunzTarPerm modified mode [ 'src/constants/Constants.js', 436, 420 ] +57 silly gunzTarPerm extractEntry src/constants/Constants.js~ +58 silly gunzTarPerm modified mode [ 'src/constants/Constants.js~', 436, 420 ] +59 silly gunzTarPerm extractEntry src/geniusClient.js +60 silly gunzTarPerm modified mode [ 'src/geniusClient.js', 436, 420 ] +61 silly gunzTarPerm extractEntry src/model/ +62 silly gunzTarPerm modified mode [ 'src/model/', 509, 493 ] +63 silly gunzTarPerm extractEntry src/model/Artist.js +64 silly gunzTarPerm modified mode [ 'src/model/Artist.js', 436, 420 ] +65 silly gunzTarPerm extractEntry src/model/Lyrics.js +66 silly gunzTarPerm modified mode [ 'src/model/Lyrics.js', 436, 420 ] +67 silly gunzTarPerm extractEntry src/model/Song.js +68 silly gunzTarPerm modified mode [ 'src/model/Song.js', 436, 420 ] +69 silly gunzTarPerm extractEntry src/parsers/ +70 silly gunzTarPerm modified mode [ 'src/parsers/', 509, 493 ] +71 silly gunzTarPerm extractEntry src/parsers/ArtistParser.js +72 silly gunzTarPerm modified mode [ 'src/parsers/ArtistParser.js', 436, 420 ] +73 silly gunzTarPerm extractEntry src/parsers/LyricsParser.js +74 silly gunzTarPerm modified mode [ 'src/parsers/LyricsParser.js', 436, 420 ] +75 silly gunzTarPerm extractEntry src/parsers/SongsParser.js +76 silly gunzTarPerm modified mode [ 'src/parsers/SongsParser.js', 436, 420 ] +77 silly gunzTarPerm extractEntry src/util/ +78 silly gunzTarPerm modified mode [ 'src/util/', 509, 493 ] +79 silly gunzTarPerm extractEntry src/util/StringUtils.js +80 silly gunzTarPerm modified mode [ 'src/util/StringUtils.js', 436, 420 ] +81 silly gunzTarPerm extractEntry test/ +82 silly gunzTarPerm modified mode [ 'test/', 509, 493 ] +83 silly gunzTarPerm extractEntry test/rapGeniusClientTest.js +84 silly gunzTarPerm modified mode [ 'test/rapGeniusClientTest.js', 436, 420 ] +85 silly gunzTarPerm extractEntry test/rockGeniusClientTest.js +86 silly gunzTarPerm modified mode [ 'test/rockGeniusClientTest.js', 436, 420 ] +87 silly gunzTarPerm extractEntry test/unitTests.js +88 silly gunzTarPerm modified mode [ 'test/unitTests.js', 436, 420 ] +89 verbose stack Error: No version provided +89 verbose stack at /usr/local/lib/node_modules/npm/lib/cache/add-local-tarball.js:132:21 +89 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:51:40 +89 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:349:17) +89 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:126:33) +89 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:266:40 +89 verbose stack at evalmachine.:336:14 +89 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:102:5 +89 verbose stack at FSReqWrap.oncomplete (evalmachine.:99:15) +90 verbose cwd /Users/smily_tiffany/Documents/Projects/RapGenius-JS/Genius-JS +91 error Darwin 14.0.0 +92 error argv "node" "/usr/local/bin/npm" "install" "https://github.com/yuichitlo/RapGenius-JS/tarball/master" +93 error node v0.12.0 +94 error npm v2.5.1 +95 error No version provided +96 error If you need help, you may report this error at: +96 error +97 verbose exit [ 1, true ] diff --git a/package.json b/package.json index f480085..36218b3 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "genius-js", "description": "A client that queries the RapGenius (www.rapgenius.com) website", "rapgenius-js": "https://github.com/yuichitlo/RapGenius-JS/tarball/master", + "version": "0.1.2", "keywords": ["rap", "rock", "rapgenius", "client", "lyrics", "music"], "author": "kenshiro-o", "main": "src/geniusClient", From 74219e4af390cc3f12257d063997b865eaa76af5 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 20:17:05 -0500 Subject: [PATCH 06/13] Works for R&B --- npm-debug.log | 117 -------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 npm-debug.log diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index 9d67db2..0000000 --- a/npm-debug.log +++ /dev/null @@ -1,117 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'node', -1 verbose cli '/usr/local/bin/npm', -1 verbose cli 'install', -1 verbose cli 'https://github.com/yuichitlo/RapGenius-JS/tarball/master' ] -2 info using npm@2.5.1 -3 info using node@v0.12.0 -4 silly cache add args [ 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', -4 silly cache add null ] -5 verbose cache add spec https://github.com/yuichitlo/RapGenius-JS/tarball/master -6 silly cache add parsed spec { raw: 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', -6 silly cache add scope: null, -6 silly cache add name: null, -6 silly cache add rawSpec: 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', -6 silly cache add spec: 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', -6 silly cache add type: 'remote' } -7 silly mapToRegistry name https://github.com/yuichitlo/RapGenius-JS/tarball/master -8 silly mapToRegistry using default registry -9 silly mapToRegistry registry https://registry.npmjs.org/ -10 silly mapToRegistry uri https://github.com/yuichitlo/RapGenius-JS/tarball/master -11 verbose addRemoteTarball https://github.com/yuichitlo/RapGenius-JS/tarball/master not in flight; adding -12 verbose addRemoteTarball [ 'https://github.com/yuichitlo/RapGenius-JS/tarball/master', -12 verbose addRemoteTarball null ] -13 info retry fetch attempt 1 at 7:58:26 PM -14 info attempt registry request try #1 at 7:58:26 PM -15 http fetch GET https://github.com/yuichitlo/RapGenius-JS/tarball/master -16 verbose request id f0f242b6f2498202 -17 http fetch 200 https://github.com/yuichitlo/RapGenius-JS/tarball/master -18 silly fetchAndShaCheck shasum 186a56fec17643e6023fe4773cfa2f2df70199d6 -19 verbose addTmpTarball /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/github.com/yuichitlo/RapGenius-JS/tarball/master not in flight; adding -20 verbose addTmpTarball validating metadata from /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/github.com/yuichitlo/RapGenius-JS/tarball/master -21 verbose tar unpack /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/github.com/yuichitlo/RapGenius-JS/tarball/master -22 verbose tar unpacking to /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/unpack-6bebba7b9f3c -23 verbose gentlyRm vacuuming /var/folders/fj/n_s27zkd3cl5bdvc1_gb_k780000gn/T/npm-52740-b09f656a/unpack-6bebba7b9f3c -24 silly gunzTarPerm modes [ '755', '644' ] -25 silly gunzTarPerm extractEntry -26 silly gunzTarPerm modified mode [ '', 509, 493 ] -27 silly gunzTarPerm extractEntry .gitignore -28 silly gunzTarPerm modified mode [ '.gitignore', 436, 420 ] -29 silly gunzTarPerm extractEntry .npmignore -30 silly gunzTarPerm modified mode [ '.npmignore', 436, 420 ] -31 silly gunzTarPerm extractEntry .travis.yml -32 silly gunzTarPerm modified mode [ '.travis.yml', 436, 420 ] -33 silly gunzTarPerm extractEntry History.md -34 silly gunzTarPerm modified mode [ 'History.md', 436, 420 ] -35 silly gunzTarPerm extractEntry Makefile -36 silly gunzTarPerm modified mode [ 'Makefile', 436, 420 ] -37 silly gunzTarPerm extractEntry README.md -38 silly gunzTarPerm modified mode [ 'README.md', 436, 420 ] -39 silly gunzTarPerm extractEntry examples/ -40 silly gunzTarPerm modified mode [ 'examples/', 509, 493 ] -41 silly gunzTarPerm extractEntry examples/artistSearch.js -42 silly gunzTarPerm modified mode [ 'examples/artistSearch.js', 436, 420 ] -43 silly gunzTarPerm extractEntry examples/lyricsSearch.js -44 silly gunzTarPerm modified mode [ 'examples/lyricsSearch.js', 436, 420 ] -45 silly gunzTarPerm extractEntry examples/songSearch.js -46 silly gunzTarPerm modified mode [ 'examples/songSearch.js', 436, 420 ] -47 silly gunzTarPerm extractEntry genius_api_lyrics.js -48 silly gunzTarPerm modified mode [ 'genius_api_lyrics.js', 436, 420 ] -49 silly gunzTarPerm extractEntry package.json -50 silly gunzTarPerm modified mode [ 'package.json', 436, 420 ] -51 silly gunzTarPerm extractEntry src/ -52 silly gunzTarPerm modified mode [ 'src/', 509, 493 ] -53 silly gunzTarPerm extractEntry src/constants/ -54 silly gunzTarPerm modified mode [ 'src/constants/', 509, 493 ] -55 silly gunzTarPerm extractEntry src/constants/Constants.js -56 silly gunzTarPerm modified mode [ 'src/constants/Constants.js', 436, 420 ] -57 silly gunzTarPerm extractEntry src/constants/Constants.js~ -58 silly gunzTarPerm modified mode [ 'src/constants/Constants.js~', 436, 420 ] -59 silly gunzTarPerm extractEntry src/geniusClient.js -60 silly gunzTarPerm modified mode [ 'src/geniusClient.js', 436, 420 ] -61 silly gunzTarPerm extractEntry src/model/ -62 silly gunzTarPerm modified mode [ 'src/model/', 509, 493 ] -63 silly gunzTarPerm extractEntry src/model/Artist.js -64 silly gunzTarPerm modified mode [ 'src/model/Artist.js', 436, 420 ] -65 silly gunzTarPerm extractEntry src/model/Lyrics.js -66 silly gunzTarPerm modified mode [ 'src/model/Lyrics.js', 436, 420 ] -67 silly gunzTarPerm extractEntry src/model/Song.js -68 silly gunzTarPerm modified mode [ 'src/model/Song.js', 436, 420 ] -69 silly gunzTarPerm extractEntry src/parsers/ -70 silly gunzTarPerm modified mode [ 'src/parsers/', 509, 493 ] -71 silly gunzTarPerm extractEntry src/parsers/ArtistParser.js -72 silly gunzTarPerm modified mode [ 'src/parsers/ArtistParser.js', 436, 420 ] -73 silly gunzTarPerm extractEntry src/parsers/LyricsParser.js -74 silly gunzTarPerm modified mode [ 'src/parsers/LyricsParser.js', 436, 420 ] -75 silly gunzTarPerm extractEntry src/parsers/SongsParser.js -76 silly gunzTarPerm modified mode [ 'src/parsers/SongsParser.js', 436, 420 ] -77 silly gunzTarPerm extractEntry src/util/ -78 silly gunzTarPerm modified mode [ 'src/util/', 509, 493 ] -79 silly gunzTarPerm extractEntry src/util/StringUtils.js -80 silly gunzTarPerm modified mode [ 'src/util/StringUtils.js', 436, 420 ] -81 silly gunzTarPerm extractEntry test/ -82 silly gunzTarPerm modified mode [ 'test/', 509, 493 ] -83 silly gunzTarPerm extractEntry test/rapGeniusClientTest.js -84 silly gunzTarPerm modified mode [ 'test/rapGeniusClientTest.js', 436, 420 ] -85 silly gunzTarPerm extractEntry test/rockGeniusClientTest.js -86 silly gunzTarPerm modified mode [ 'test/rockGeniusClientTest.js', 436, 420 ] -87 silly gunzTarPerm extractEntry test/unitTests.js -88 silly gunzTarPerm modified mode [ 'test/unitTests.js', 436, 420 ] -89 verbose stack Error: No version provided -89 verbose stack at /usr/local/lib/node_modules/npm/lib/cache/add-local-tarball.js:132:21 -89 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:51:40 -89 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:349:17) -89 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:126:33) -89 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:266:40 -89 verbose stack at evalmachine.:336:14 -89 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:102:5 -89 verbose stack at FSReqWrap.oncomplete (evalmachine.:99:15) -90 verbose cwd /Users/smily_tiffany/Documents/Projects/RapGenius-JS/Genius-JS -91 error Darwin 14.0.0 -92 error argv "node" "/usr/local/bin/npm" "install" "https://github.com/yuichitlo/RapGenius-JS/tarball/master" -93 error node v0.12.0 -94 error npm v2.5.1 -95 error No version provided -96 error If you need help, you may report this error at: -96 error -97 verbose exit [ 1, true ] From 1c574b7165aeb6d19210c0513ea7e915b0eed509 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 21:05:04 -0500 Subject: [PATCH 07/13] Removed type-based search, added artist to search criteria --- genius_api_lyrics.js | 9 +-- src/constants/Constants.js | 6 ++ src/geniusClient.js | 119 ++++++++++++++++++------------------ src/model/Artist.js | 8 +-- src/parsers/ArtistParser.js | 14 ++--- src/parsers/LyricsParser.js | 22 +++---- src/parsers/SongsParser.js | 12 ++-- 7 files changed, 99 insertions(+), 91 deletions(-) diff --git a/genius_api_lyrics.js b/genius_api_lyrics.js index a57f80c..6dd4512 100644 --- a/genius_api_lyrics.js +++ b/genius_api_lyrics.js @@ -1,4 +1,4 @@ -var rapgeniusClient = require("rapgenius-js"); +var geniusClient = require("genius-js"); var lyricsSearchCb = function(err, lyricsAndExplanations){ if(err){ @@ -25,9 +25,10 @@ var searchCallback = function(err, songs){ }else{ if(songs.length > 0){ //We have some songs - rapgeniusClient.searchLyricsAndExplanations(songs[0].link, "r&b", lyricsSearchCb); + console.log("SONG ID: " + songs[0].songId) + geniusClient.searchLyricsAndExplanations(songs[0].link, "r-b", lyricsSearchCb); } } }; - -rapgeniusClient.searchSong("Drunk in Love", "r-b", searchCallback); \ No newline at end of file +geniusClient.searchSong("Beat It", "r-b", searchCallback); +geniusClient.searchSong("Beat It", "rock", searchCallback); \ No newline at end of file diff --git a/src/constants/Constants.js b/src/constants/Constants.js index 173a368..591330f 100644 --- a/src/constants/Constants.js +++ b/src/constants/Constants.js @@ -1,4 +1,10 @@ var Type2URLs = { + "urls": { + "artist_url":"http://genius.com/artists/", + "base_url":"http://genius.com", + "search_url":"http://genius.com/search", + "annotations_url": "http://genius.com/annotations/for_song_page" + }; "rock": { "artist_url":"http://rock.rapgenius.com/artists/", "base_url":"http://rock.rapgenius.com", diff --git a/src/geniusClient.js b/src/geniusClient.js index a6c1046..549aa3d 100644 --- a/src/geniusClient.js +++ b/src/geniusClient.js @@ -1,32 +1,32 @@ var superAgent = require("superagent"), - RapSongParser = require("./parsers/SongsParser"), - RapArtistParser = require("./parsers/ArtistParser"), - RapLyricsParser = require("./parsers/LyricsParser") + SongParser = require("./parsers/SongsParser"), + ArtistParser = require("./parsers/ArtistParser"), + LyricsParser = require("./parsers/LyricsParser") Constants = require("./constants/Constants"); -var RAP_GENIUS_URL = "http://rapgenius.com"; -var RAP_GENIUS_ARTIST_URL = "http://rapgenius.com/artists/"; -var RAP_GENIUS_SONG_EXPLANATION_URL = RAP_GENIUS_URL + "/annotations/for_song_page"; +var GENIUS_URL = "http://genius.com"; +var GENIUS_ARTIST_URL = "http://genius.com/artists/"; +var GENIUS_SONG_EXPLANATION_URL = GENIUS_URL + "/annotations/for_song_page"; -function searchSong(query, type, callback) { +function searchSong(query, artist, callback) { //TODO perform input validation - type = type.toLowerCase(); - var type2Urls = Constants.Type2URLs[ type]; - if (!type2Urls){ - process.nextTick(function(){ - callback("Unrecognized type in song search [type=" + type + "]"); - }); - return; - } - - superAgent.get(type2Urls.search_url) - .query({q: query}) + // type = type.toLowerCase(); + // var type2Urls = Constants.Type2URLs[ type]; + // if (!type2Urls){ + // process.nextTick(function(){ + // callback("Unrecognized type in song search [type=" + type + "]"); + // }); + // return; + // } + + superAgent.get("http://genius.com/search") + .query({q: query + artist}) .set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .end(function (res) { if (res.ok) { - var result = RapSongParser.parseSongHTML(res.text, type); + var result = SongParser.parseSongHTML(res.text); if (result instanceof Error) { return callback(result); } else { @@ -39,23 +39,23 @@ function searchSong(query, type, callback) { }); } -function searchArtist(artist, type, callback) { +function searchArtist(artist, callback) { //TODO perform input validation - type = type.toLowerCase(); - var type2Urls = Constants.Type2URLs[ type]; - if (!type2Urls){ - process.nextTick(function(){ - callback("Unrecognized type in artist search [type=" + type + "]"); - }); - return; - } - - superAgent.get(type2Urls.artist_url + artist) + // type = type.toLowerCase(); + // var type2Urls = Constants.Type2URLs[ type]; + // if (!type2Urls){ + // process.nextTick(function(){ + // callback("Unrecognized type in artist search [type=" + type + "]"); + // }); + // return; + // } + + superAgent.get("http://genius.com/artists/" + artist) .set("Accept", "text/html") .end(function (res) { debugger; if (res.ok) { - var result = RapArtistParser.parseArtistHTML(res.text, type); + var result = ArtistParser.parseArtistHTML(res.text); if (result instanceof Error) { return callback(result); } else { @@ -69,23 +69,23 @@ function searchArtist(artist, type, callback) { } -function searchSongLyrics(link, type, callback){ +function searchSongLyrics(link, callback){ //Check whether the URL is fully defined or relative - type = type.toLowerCase(); - var type2Urls = Constants.Type2URLs[ type]; - if (!type2Urls){ - process.nextTick(function(){ - callback("Unrecognized type in song lyrics search [type=" + type + "]"); - }); - return; - } - - var url = /^http/.test(link) ? link : type2Urls.base_url + link; + // type = type.toLowerCase(); + // var type2Urls = Constants.Type2URLs[ type]; + // if (!type2Urls){ + // process.nextTick(function(){ + // callback("Unrecognized type in song lyrics search [type=" + type + "]"); + // }); + // return; + // } + + var url = /^http/.test(link) ? link : "http://genius.com" + link; superAgent.get(url) .set("Accept", "text/html") .end(function(res){ if(res.ok){ - var result = RapLyricsParser.parseLyricsHTML(res.text, type); + var result = LyricsParser.parseLyricsHTML(res.text); if(result instanceof Error){ return callback(result); }else{ @@ -98,24 +98,24 @@ function searchSongLyrics(link, type, callback){ }); } -function searchLyricsExplanation(songId, type, callback){ +function searchLyricsExplanation(songId, callback){ //Check whether the URL is fully defined or relative - type = type.toLowerCase(); - var type2Urls = Constants.Type2URLs[ type]; - if (!type2Urls){ - process.nextTick(function(){ - callback("Unrecognized type in song lyrics search [type=" + type + "]"); - }); - return; - } + // type = type.toLowerCase(); + // var type2Urls = Constants.Type2URLs[ type]; + // if (!type2Urls){ + // process.nextTick(function(){ + // callback("Unrecognized type in song lyrics search [type=" + type + "]"); + // }); + // return; + // } - superAgent.get(type2Urls.annotations_url) + superAgent.get("http://genius.com/annotations/for_song_page") .set("Accept", "text/html") .query({song_id: songId}) .end(function(res){ if(res.ok){ - var explanations = RapLyricsParser.parseLyricsExplanationJSON(JSON.parse(res.text)); + var explanations = LyricsParser.parseLyricsExplanationJSON(JSON.parse(res.text)); if(explanations instanceof Error){ return callback(explanations); }else{ @@ -128,14 +128,15 @@ function searchLyricsExplanation(songId, type, callback){ }); } -function searchLyricsAndExplanations(link, type, callback){ +function searchLyricsAndExplanations(link, callback){ var lyrics = null; - var lyricsCallback = function(err, rapLyrics){ + var lyricsCallback = function(err, lyrics){ if(err){ return callback(err); }else{ - lyrics = rapLyrics; - searchLyricsExplanation(lyrics.songId, type, explanationsCallback); + //lyrics = rapLyrics; + console.log("SongID: " + lyrics.songId) + searchLyricsExplanation(lyrics.songId, explanationsCallback); } }; @@ -147,7 +148,7 @@ function searchLyricsAndExplanations(link, type, callback){ } }; - searchSongLyrics(link, type, lyricsCallback); + searchSongLyrics(link, lyricsCallback); } module.exports.searchSong = searchSong; diff --git a/src/model/Artist.js b/src/model/Artist.js index 5c6978d..606c1e5 100644 --- a/src/model/Artist.js +++ b/src/model/Artist.js @@ -12,12 +12,12 @@ Artist.prototype = { songs: null }; -Artist.prototype.addPopularSong = function (rapSong) { - this.popularSongs.push(rapSong); +Artist.prototype.addPopularSong = function (song) { + this.popularSongs.push(song); }; -Artist.prototype.addSong = function (rapSong) { - this.songs.push(rapSong); +Artist.prototype.addSong = function (song) { + this.songs.push(song); }; diff --git a/src/parsers/ArtistParser.js b/src/parsers/ArtistParser.js index 9fca8a4..6150a5d 100644 --- a/src/parsers/ArtistParser.js +++ b/src/parsers/ArtistParser.js @@ -5,9 +5,9 @@ var cheerio = require("cheerio"), StringUtils = require("../util/StringUtils"); -function parseArtistHTML(html, type) { +function parseArtistHTML(html) { try { - var urls = CONSTANTS.Type2URLs[type]; + var urls = CONSTANTS.Type2URLs["urls"]; var $ = cheerio.load(html); var artistElem = $(".canonical_name", "#main"); @@ -28,7 +28,7 @@ function parseArtistHTML(html, type) { }); var artistLink = urls.artist_url + artistName.replace(" ", "-"); - var rapArtist = new Artist(artistName, artistLink); + var cur_artist = new Artist(artistName, artistLink); var songs = $(".song_list", "#main"); songs.each(function (index, song) { @@ -40,18 +40,18 @@ function parseArtistHTML(html, type) { if (index === 0) { //This element represents the favourite songs of the artist - rapArtist.addPopularSong(rapSong); + cur_artist.addPopularSong(rapSong); } - rapArtist.addSong(rapSong); + cur_artist.addSong(rapSong); }); }); - return rapArtist; + return cur_artist; } catch (e) { console.log("An error occured while trying to parse the artist: [html=" + html + "], error: " + e); - return new Error("Unable to parse artist details results from RapGenius"); + return new Error("Unable to parse artist details results from Genius"); } } diff --git a/src/parsers/LyricsParser.js b/src/parsers/LyricsParser.js index 9bd8b8c..0e59b75 100644 --- a/src/parsers/LyricsParser.js +++ b/src/parsers/LyricsParser.js @@ -2,7 +2,7 @@ var cheerio = require("cheerio"), Lyrics = require("../model/Lyrics"), StringUtils = require("../util/StringUtils"); -function parseLyricsHTML(html, type) { +function parseLyricsHTML(html) { try { var $ = cheerio.load(html); @@ -32,7 +32,7 @@ function parseLyricsHTML(html, type) { if (lyricsContainer.length <= 0) { return new Error("Unable to parse lyrics: lyrics_container does not exist!"); } - var rapLyrics = null; + var cur_lyrics = null; var currentSection = new Lyrics.Section("[Empty Section]"); @@ -41,11 +41,11 @@ function parseLyricsHTML(html, type) { //The lyrics class holds the paragraphs that contain the lyrics var lyricsElems = $(container).find(".lyrics"); var songId = parseInt($(lyricsElems.first()).attr("data-id")); - rapLyrics = new Lyrics.Lyrics(songId, 10); - rapLyrics.songTitle = songTitle; - rapLyrics.mainArtist = mainArtist; - rapLyrics.featuringArtists = ftList; - rapLyrics.producingArtists = prodList; + cur_lyrics = new Lyrics.Lyrics(songId, 10); + cur_lyrics.songTitle = songTitle; + cur_lyrics.mainArtist = mainArtist; + cur_lyrics.featuringArtists = ftList; + cur_lyrics.producingArtists = prodList; var currentVerses = null; @@ -58,7 +58,7 @@ function parseLyricsHTML(html, type) { //check if parsed content is a section if (/^\[.*\]$/.test(parsed)) { currentSection = new Lyrics.Section(parsed); - rapLyrics.addSection(currentSection); + cur_lyrics.addSection(currentSection); } else { //Not a section name, therefore this must be text //However we only want to add non empty strings @@ -98,10 +98,10 @@ function parseLyricsHTML(html, type) { lyricsElems.find("p").each(parserFunc); }); - if (rapLyrics.sections.length === 0){ - rapLyrics.addSection(currentSection); + if (cur_lyrics.sections.length === 0){ + cur_lyrics.addSection(currentSection); } - return rapLyrics; + return cur_lyrics; } catch (e) { console.log("An error occurred while trying to parse the lyrics: [html=" + html + "], :\n" + e); return new Error("Unable to parse lyrics from RapGenius"); diff --git a/src/parsers/SongsParser.js b/src/parsers/SongsParser.js index 75c3e25..7fc51c3 100644 --- a/src/parsers/SongsParser.js +++ b/src/parsers/SongsParser.js @@ -4,15 +4,15 @@ var cheerio = require("cheerio"), StringUtils = require("../util/StringUtils"); -function parseSongHTML(html, type) { +function parseSongHTML(html) { //TODO Check we are dealing with proper HTML //or something that looks like HTML, otherwise throw an error try { - var urls = CONSTANTS.Type2URLs[type]; + var urls = CONSTANTS.Type2URLs["urls"]; var $ = cheerio.load(html); var songs = $(".song_link", "#main"); - var rapSongArray = new Array(songs.length); + var songArray = new Array(songs.length); songs.each(function (index, song) { var link = $(this).attr("href"); @@ -29,13 +29,13 @@ function parseSongHTML(html, type) { var artists = StringUtils.trim(songAndArtists.substring(0, indexOfHyphen)); var songName = StringUtils.trim(songAndArtists.substring(indexOfHyphen + 1, songAndArtists.length)); - rapSongArray[index] = new Song(songName, artists, link); + songArray[index] = new Song(songName, artists, link); }); - return rapSongArray; + return songArray; } catch (e) { console.log("An error occured while trying to parse the songs: [html=" + html + "]"); - return new Error("Unable to parse song search results from RapGenius"); + return new Error("Unable to parse song search results from Genius"); } } From a18a9d6726b2aa72fa8618deb5b05a0f94f25455 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 21:11:10 -0500 Subject: [PATCH 08/13] Missed comma --- src/constants/Constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/Constants.js b/src/constants/Constants.js index 591330f..db8f5aa 100644 --- a/src/constants/Constants.js +++ b/src/constants/Constants.js @@ -4,7 +4,7 @@ var Type2URLs = { "base_url":"http://genius.com", "search_url":"http://genius.com/search", "annotations_url": "http://genius.com/annotations/for_song_page" - }; + }, "rock": { "artist_url":"http://rock.rapgenius.com/artists/", "base_url":"http://rock.rapgenius.com", From 95f3161dbd5da8359e1efb83ffc60a8fbea55197 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 21:29:23 -0500 Subject: [PATCH 09/13] Fixed annotations error --- src/geniusClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geniusClient.js b/src/geniusClient.js index 549aa3d..76798db 100644 --- a/src/geniusClient.js +++ b/src/geniusClient.js @@ -130,7 +130,7 @@ function searchLyricsExplanation(songId, callback){ function searchLyricsAndExplanations(link, callback){ var lyrics = null; - var lyricsCallback = function(err, lyrics){ + var lyricsCallback = function(err, cur_lyrics){ if(err){ return callback(err); }else{ From 2248479ab96d22f5536415d76c36970be15ac9f6 Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 21:33:09 -0500 Subject: [PATCH 10/13] Actually fixed annotation bug --- src/geniusClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geniusClient.js b/src/geniusClient.js index 76798db..eddfe54 100644 --- a/src/geniusClient.js +++ b/src/geniusClient.js @@ -134,7 +134,7 @@ function searchLyricsAndExplanations(link, callback){ if(err){ return callback(err); }else{ - //lyrics = rapLyrics; + lyrics = cur_lyrics; console.log("SongID: " + lyrics.songId) searchLyricsExplanation(lyrics.songId, explanationsCallback); } From 0d13417f7b2137e6bc87a2db3ea0c89afcaff2ab Mon Sep 17 00:00:00 2001 From: Yui Chi Tiffany Lo Date: Sat, 21 Feb 2015 22:10:06 -0500 Subject: [PATCH 11/13] Revised examples and package.json; Fall Out Boy Beat It annotation still null --- examples/artistSearch.js | 16 +++------------- examples/lyricsSearch.js | 6 +++--- examples/songSearch.js | 4 ++-- package.json | 6 +++--- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/examples/artistSearch.js b/examples/artistSearch.js index 9dc2cb2..0b40085 100644 --- a/examples/artistSearch.js +++ b/examples/artistSearch.js @@ -1,21 +1,11 @@ -var rapgeniusClient = require("../src/geniusClient.js"); +var geniusClient = require("../src/geniusClient.js"); -rapgeniusClient.searchArtist("GZA", "rap", function(err, artist){ +geniusClient.searchArtist("GZA", function(err, artist){ if(err){ console.log("Error: " + err); }else{ - console.log("Rap artist found [name=%s, link=%s, popular-songs=%d]", + console.log("Artist found [name=%s, link=%s, popular-songs=%d]", artist.name, artist.link, artist.popularSongs.length); } -}); - -//Example for a rock artist -rapgeniusClient.searchArtist("Bruce Springsteen", "rock", function(err, artist){ - if(err){ - console.log("Error: " + err); - }else{ - console.log("Rap artist found [name=%s, link=%s, popular-songs=%d]", - artist.name, artist.link, artist.popularSongs.length); - } }); \ No newline at end of file diff --git a/examples/lyricsSearch.js b/examples/lyricsSearch.js index 125dab4..05b9659 100644 --- a/examples/lyricsSearch.js +++ b/examples/lyricsSearch.js @@ -1,4 +1,4 @@ -var rapgeniusClient = require("../src/geniusClient"); +var geniusClient = require("../src/geniusClient"); var lyricsSearchCb = function(err, lyricsAndExplanations){ if(err){ @@ -24,9 +24,9 @@ var searchCallback = function(err, songs){ }else{ if(songs.length > 0){ //We have some songs - rapgeniusClient.searchLyricsAndExplanations(songs[0].link, "rap", lyricsSearchCb); + geniusClient.searchLyricsAndExplanations(songs[0].link, lyricsSearchCb); } } }; -rapgeniusClient.searchSong("Liquid Swords", "rap", searchCallback); \ No newline at end of file +geniusClient.searchSong("Liquid Swords", "GZA", searchCallback); \ No newline at end of file diff --git a/examples/songSearch.js b/examples/songSearch.js index e65d297..cac5e15 100644 --- a/examples/songSearch.js +++ b/examples/songSearch.js @@ -1,6 +1,6 @@ -var rapgeniusClient = require("../src/geniusClient"); +var geniusClient = require("../src/geniusClient"); -rapgeniusClient.searchSong("Liquid Swords", "rap", function(err, songs){ +geniusClient.searchSong("Liquid Swords", "GZA", function(err, songs){ if(err){ console.log("Error: " + err); }else{ diff --git a/package.json b/package.json index 36218b3..b296d3a 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "genius-js", "description": "A client that queries the RapGenius (www.rapgenius.com) website", - "rapgenius-js": "https://github.com/yuichitlo/RapGenius-JS/tarball/master", + "genius-js": "https://github.com/yuichitlo/Genius-JS/tarball/master", "version": "0.1.2", "keywords": ["rap", "rock", "rapgenius", "client", "lyrics", "music"], - "author": "kenshiro-o", + "author": "kenshiro-o, yuichitlo", "main": "src/geniusClient", "repository": { "type": "git", - "url": "git://github.com/yuichitlo/RapGenius-JS.git" + "url": "git://github.com/yuichitlo/Genius-JS.git" }, "dependencies": { "superagent": "0.12.x", From cbde7ec879b1fac727b7ffcd089a330874d86362 Mon Sep 17 00:00:00 2001 From: Tiffany Date: Sat, 21 Feb 2015 22:13:15 -0500 Subject: [PATCH 12/13] Update README.md --- README.md | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index db2fde9..aeaf235 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# RapGenius-JS [![Build Status](https://travis-ci.org/kenshiro-o/RapGenius-JS.png?branch=master)](https://travis-ci.org/kenshiro-o/RapGenius-JS) +# Genius-JS [![Build Status](https://travis-ci.org/kenshiro-o/RapGenius-JS.png?branch=master)](https://travis-ci.org/kenshiro-o/RapGenius-JS) - rapgenius-js is a simple client that enables you to query RapGenius(www.rapgenius.com) and retrieve + Genius-js is a simple client that enables you to query Genius(www.genius.com) and retrieve information about rap and rock artists and songs. ## Rationale - This project was created because RapGenius does currently not support a Node.js API. + This project was created because Genius does currently not support a Node.js API. ## Installation ```bash -$ npm install rapgenius-js +$ npm install genius-js ``` ## Usage @@ -54,36 +54,26 @@ $ npm install rapgenius-js ### Search for an artist: ```js -var rapgeniusClient = require("rapgenius-js"); +var geniusClient = require("genius-js"); -rapgeniusClient.searchArtist("GZA", "rap", function(err, artist){ +rapgeniusClient.searchArtist("GZA", function(err, artist){ if(err){ console.log("Error: " + err); }else{ - console.log("Rap artist found [name=%s, link=%s, popular-songs=%d]", + console.log("Artist found [name=%s, link=%s, popular-songs=%d]", artist.name, artist.link, artist.popularSongs.length); } }); -//Example for a rock artist -rapgeniusClient.searchArtist("Bruce Springsteen", "rock", function(err, artist){ - if(err){ - console.log("Error: " + err); - }else{ - console.log("Rap artist found [name=%s, link=%s, popular-songs=%d]", - artist.name, artist.link, artist.popularSongs.length); - - } -}); ``` ### Search for a song: ```js -var rapgeniusClient = require("rapgenius-js"); +var geniusClient = require("genius-js"); -rapgeniusClient.searchSong("Liquid Swords", "rap", function(err, songs){ +geniusClient.searchSong("Liquid Swords", "GZA", function(err, songs){ if(err){ console.log("Error: " + err); }else{ @@ -96,7 +86,7 @@ rapgeniusClient.searchSong("Liquid Swords", "rap", function(err, songs){ ### Search for the lyrics of a song along with their meaning: ```js -var rapgeniusClient = require("rapgenius-js"); +var geniusClient = require("genius-js"); var lyricsSearchCb = function(err, lyricsAndExplanations){ if(err){ @@ -122,12 +112,12 @@ var searchCallback = function(err, songs){ }else{ if(songs.length > 0){ //We have some songs - rapgeniusClient.searchLyricsAndExplanations(songs[0].link, "rap", lyricsSearchCb); + geniusClient.searchLyricsAndExplanations(songs[0].link, lyricsSearchCb); } } }; -rapgeniusClient.searchSong("Liquid Swords", "rap", searchCallback); +geniusClient.searchSong("Liquid Swords", "GZA", searchCallback); ``` From 19c8b86536a54642ef407ba27d072bf94a17e411 Mon Sep 17 00:00:00 2001 From: Tiffany Date: Sat, 21 Feb 2015 22:15:11 -0500 Subject: [PATCH 13/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aeaf235..3fe9861 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Genius-JS [![Build Status](https://travis-ci.org/kenshiro-o/RapGenius-JS.png?branch=master)](https://travis-ci.org/kenshiro-o/RapGenius-JS) Genius-js is a simple client that enables you to query Genius(www.genius.com) and retrieve -information about rap and rock artists and songs. +information about rap and rock artists and songs. This project has been forked from kenshiro-o's RapGenius-JS and altered to support all areas of Genius rather than just Rap and Rock genius. ## Rationale