Support actual google play music album share urls
This commit is contained in:
parent
f8d3ea92b1
commit
aca2eea4dd
1 changed files with 18 additions and 12 deletions
|
@ -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"});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue