2025-05-20 13:18:38 +01:00
|
|
|
import { parse } from "url";
|
2014-12-11 19:53:12 +00:00
|
|
|
|
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);
|
2014-12-11 19:53:12 +00:00
|
|
|
|
2025-05-20 13:18:38 +01:00
|
|
|
if (
|
|
|
|
!parsed.host.match(/itunes\.apple\.com$/) &&
|
|
|
|
!parsed.host.match(/music\.apple\.com$/)
|
|
|
|
) {
|
2014-12-11 19:53:12 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2025-05-20 13:18:38 +01:00
|
|
|
const matches = parsed.path.match(
|
|
|
|
/[/]?([/]?[a-z]{2}?)?[/]+(song|album)[/]+([^/]+)[/]+([^?]+)/
|
|
|
|
);
|
2014-12-11 19:53:12 +00:00
|
|
|
|
2025-05-20 13:18:38 +01:00
|
|
|
return !!matches[4];
|
2017-07-20 14:31:07 +01:00
|
|
|
}
|