combine.fm/lib/services/xbox/url.js

12 lines
275 B
JavaScript
Raw Normal View History

2015-08-20 23:22:57 +01:00
import { parse } from 'url';
2014-12-21 01:19:37 +00:00
2015-08-20 23:22:57 +01:00
export function* match(url, type) {
const parsed = parse(url);
2014-12-21 01:19:37 +00:00
if (!parsed.host.match(/music.xbox.com$/)) {
return false;
}
2015-08-20 23:22:57 +01:00
const parts = parsed.path.split("/");
2014-12-21 01:19:37 +00:00
return (parts[1] == "album" || parts[1] == "track") && parts[4];
};