-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextractors.js
84 lines (81 loc) · 2.43 KB
/
extractors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
function url_rxn(base, optional) {
optional = optional || "";
return new RegExp(`^https?://(?:\\w+\\.)?${base}(?:${optional})?`, "i");
}
function url_rx(base, optional) {
return url_rxn(base.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), optional);
}
function extractor(media_type) {
return (result) => [result[1], media_type]
}
const extractors = [
{
channel_id: 12,
name: "Netflix",
url_regexp: url_rx("netflix.com", "/(title|watch)/(\\d+)"),
url_extractor: (result) => {
const media_type = result[1] == "title" ? "season" : "episode";
return [result[2], media_type];
}
},
{
channel_id: 13,
name: "Prime Video",
url_regexp: url_rxn("amazon\\.com/(?:Amazon-Video|gp/video/detail/(\\w+))"),
url_extractor: extractor("season"),
},
{
channel_id: 28,
name: "Pandora",
url_regexp: url_rx("pandora.com", "/station/play/(\\d+)"),
url_extractor: extractor("live")
},
{
channel_id: 837,
name: "YouTube",
url_regexp: url_rx("youtube.com", "/watch\\?v=([\\w-]+)"),
url_extractor: extractor("episode")
},
{
channel_id: 14654, name: "Funimation", url_regexp: url_rx("funimation.com")
},
{
channel_id: 2285, name: "Hulu", url_regexp: url_rx("hulu.com"),
},
{
channel_id: 2595, name: "Crunchyroll", url_regexp: url_rx("crunchyroll.com"),
},
{
channel_id: 13535, name: "Plex", url_regexp: url_rx("plex.tv"),
},
{
channel_id: 13842,
name: "VUDU",
url_regexp: url_rx("vudu.com", "/.+/(\\d+)"),
url_extractor: extractor("movie")
},
{
channel_id: 61322,
name: "HBO Max",
url_regexp: url_rx("hbomax.com", "/(episode|feature)/([\\w:]+)"),
url_extractor: (result) => {
let media_type = result[1] == "feature" ? "movie" : result[1];
return [result[2], media_type];
}
},
{
channel_id: 143105, name: "VRV", url_regexp: url_rx("vrv.co")
},
{
channel_id: 291097, name: "Disney Plus", url_regexp: url_rx("disneyplus.com"),
},
{
channel_id: 591927, name: "Twoku", url_regexp: url_rx("twitch.tv")
},
{
channel_id: 593099,
name: "Peacock",
url_regexp: url_rx("peacocktv.com", "/watch/playback/vod/\\w+/([\\w-]+)"),
url_extractor: extractor("episode")
}
];