Support actual google play music album share urls

This commit is contained in:
Jonathan Cremin 2014-11-30 23:07:55 +00:00
parent f8d3ea92b1
commit aca2eea4dd

View file

@ -40,20 +40,26 @@ module.exports.parseUrl = function(url, next) {
// https://play.google.com/music/listen#/album/B3lxthejqxjxja2bhzchcw5qaci // https://play.google.com/music/listen#/album/B3lxthejqxjxja2bhzchcw5qaci
// https://play.google.com/music/listen#/album//Underworld/Everything%2C+Everything+(Live) // https://play.google.com/music/listen#/album//Underworld/Everything%2C+Everything+(Live)
var parsed = parse(url.replace(/\+/g, "%20")); var parsed = parse(url.replace(/\+/g, "%20"));
var path = parsed.path;
var hash = parsed.hash; var hash = parsed.hash;
console.log(path)
if (hash) {
var matches = hash.match(/\/album[\/]+([^\/]+)\/([^\/]+)/);
var matches = hash.match(/\/album[\/]+([^\/]+)\/([^\/]+)/); if (matches && matches[2]) {
var artist = decodeURIComponent(matches[1]);
if (matches && matches[2]) { var album = decodeURIComponent(matches[2]);
var artist = decodeURIComponent(matches[1]); module.exports.search(artist + " " + album, "album", function(googleAlbum) {
var album = decodeURIComponent(matches[2]); next(googleAlbum);
module.exports.search(artist + " " + album, "album", function(googleAlbum) { });
next(googleAlbum); } else {
}) var matches = hash.match(/\/album[\/]+([\w]+)/);
} else { if (matches && matches[1]) {
var matches = hash.match(/\/album[\/]+([\w]+)/); return next({id:matches[1], type: "album"});
if (matches && matches[1]) { }
return next({id:matches[1], type: "album"})
} }
} else if(path) {
var matches = path.match(/\/music\/m\/([\w]+)/);
return next({id:matches[1], type: "album"});
} }
} }