Some service api fixes

This commit is contained in:
Jonathan Cremin 2025-05-20 13:18:38 +01:00
parent 2225712d5f
commit 3ea715de39
6 changed files with 425 additions and 249 deletions

View file

@ -1,13 +1,18 @@
import { parse } from 'url';
import { parse } from "url";
export default function match(url) {
const parsed = parse(url);
if (!parsed.host.match(/itunes.apple\.com$/)) {
if (
!parsed.host.match(/itunes\.apple\.com$/) &&
!parsed.host.match(/music\.apple\.com$/)
) {
return false;
}
const matches = parsed.path.match(/[/]?([/]?[a-z]{2}?)?[/]+album[/]+([^/]+)[/]+([^?]+)/);
const matches = parsed.path.match(
/[/]?([/]?[a-z]{2}?)?[/]+(song|album)[/]+([^/]+)[/]+([^?]+)/
);
return !!matches[3];
return !!matches[4];
}