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

14 lines
288 B
JavaScript
Raw Normal View History

2015-08-20 23:22:57 +01:00
import { parse } from 'url';
2017-07-20 14:31:07 +01:00
export default function match(url) {
2015-08-20 23:22:57 +01:00
const parsed = parse(url);
if (!parsed.host.match(/itunes.apple\.com$/)) {
return false;
}
2017-07-20 14:31:07 +01:00
const matches = parsed.path.match(/[/]?([/]?[a-z]{2}?)?[/]+album[/]+([^/]+)[/]+([^?]+)/);
return !!matches[3];
2017-07-20 14:31:07 +01:00
}