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//Underworld/Everything%2C+Everything+(Live)
var parsed = parse(url.replace(/\+/g, "%20"));
var path = parsed.path;
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]);
var album = decodeURIComponent(matches[2]);
module.exports.search(artist + " " + album, "album", function(googleAlbum) {
next(googleAlbum);
})
} else {
var matches = hash.match(/\/album[\/]+([\w]+)/);
if (matches && matches[1]) {
return next({id:matches[1], type: "album"})
if (matches && matches[2]) {
var artist = decodeURIComponent(matches[1]);
var album = decodeURIComponent(matches[2]);
module.exports.search(artist + " " + album, "album", function(googleAlbum) {
next(googleAlbum);
});
} else {
var matches = hash.match(/\/album[\/]+([\w]+)/);
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"});
}
}