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

12 lines
269 B
JavaScript
Raw Normal View History

2018-04-08 16:31:46 +01:00
import { parse } from 'url';
export default function match(url) {
const parsed = parse(url);
if (!parsed.host.match(/\.amazon\.com$/)) {
return false;
}
const matches = parse(url).path.match(/\/(albums)[/]+([^/]+)/);
return (matches && !!matches[2]);
}