Some service api fixes
This commit is contained in:
parent
2225712d5f
commit
3ea715de39
6 changed files with 425 additions and 249 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue