Fix Google Play Music and Spotify

This commit is contained in:
Jonathan Cremin 2017-07-20 14:31:07 +01:00
parent 688ec0f2f9
commit 6c29d50f1e
21 changed files with 566 additions and 559 deletions

View file

@ -1,7 +1,7 @@
import { parse } from 'url';
export function* match(url) {
var parsed = parse(url.replace(/\+/g, "%20"));
export default function match(url) {
const parsed = parse(url.replace(/\+/g, '%20'));
if (!parsed.host.match(/play\.google\.com$/)) {
return false;
}
@ -10,7 +10,7 @@ export function* match(url) {
const hash = parsed.hash;
if (hash) {
const parts = hash.split("/");
const parts = hash.split('/');
const id = parts[2];
const artist = parts[3];
@ -19,11 +19,11 @@ export function* match(url) {
} else if (artist.length > 0) {
return true;
}
} else if(path) {
} else if (path) {
const matches = path.match(/\/music\/m\/([\w]+)/);
if (matches[1]) {
return true
return true;
}
}
return false
};
return false;
}