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

12 lines
273 B
JavaScript
Raw Normal View History

2015-08-20 23:22:57 +01:00
import { parse } from 'url';
2015-08-20 23:22:57 +01:00
export function* match(url, type) {
const parsed = parse(url);
if (!parsed.host.match(/spotify\.com$/)) {
return false;
}
2015-08-20 23:22:57 +01:00
const matches = parse(url).path.match(/\/(album|track)[\/]+([^\/]+)/);
2015-01-13 12:44:06 +00:00
return matches && !!matches[2];
};