forked from Guovin/iptv-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
122 lines (96 loc) · 3.21 KB
/
constants.py
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import os
import re
config_path = "config"
output_path = "output"
whitelist_path = os.path.join(config_path, "whitelist.txt")
blacklist_path = os.path.join(config_path, "blacklist.txt")
subscribe_path = os.path.join(config_path, "subscribe.txt")
result_path = os.path.join(output_path, "result_new.txt")
cache_path = os.path.join(output_path, "cache.pkl")
sort_log_path = os.path.join(output_path, "sort.log")
log_path = os.path.join(output_path, "log.log")
url_host_pattern = re.compile(r"((https?|rtmp|rtsp)://)?([^:@/]+(:[^:@/]*)?@)?(\[[0-9a-fA-F:]+]|([\w-]+\.)+[\w-]+)")
url_pattern = re.compile(url_host_pattern.pattern + r"(.*)?")
rt_url_pattern = re.compile(r"^(rtmp|rtsp)://.*$")
rtp_pattern = re.compile(r"^([^,,]+)[,,]?(rtp://.*)$")
demo_txt_pattern = re.compile(r"^([^,,]+)[,,]?(?!#genre#)" + r"(" + url_pattern.pattern + r")?")
txt_pattern = re.compile(r"^([^,,]+)[,,](?!#genre#)" + r"(" + url_pattern.pattern + r")")
multiline_txt_pattern = re.compile(r"^([^,,]+)[,,](?!#genre#)" + r"(" + url_pattern.pattern + r")", re.MULTILINE)
m3u_pattern = re.compile(r"^#EXTINF:-1.*?[,,](.*?)\n" + r"(" + url_pattern.pattern + r")")
multiline_m3u_pattern = re.compile(r"^#EXTINF:-1.*?[,,](.*?)\n" + r"(" + url_pattern.pattern + r")", re.MULTILINE)
sub_pattern = re.compile(
r"-|_|\((.*?)\)|((.*?))|\[(.*?)]|「(.*?)」| |||频道|普清|标清|高清|HD|hd|超清|超高|超高清|中央|央视|电视台|台|电信|联通|移动")
replace_dict = {
"plus": "+",
"PLUS": "+",
"+": "+",
"CCTV1综合": "CCTV1",
"CCTV2财经": "CCTV2",
"CCTV3综艺": "CCTV3",
"CCTV4国际": "CCTV4",
"CCTV4中文国际": "CCTV4",
"CCTV4欧洲": "CCTV4",
"CCTV5体育": "CCTV5",
"CCTV5+体育赛视": "CCTV5+",
"CCTV5+体育赛事": "CCTV5+",
"CCTV5+体育": "CCTV5+",
"CCTV6电影": "CCTV6",
"CCTV7军事": "CCTV7",
"CCTV7军农": "CCTV7",
"CCTV7农业": "CCTV7",
"CCTV7国防军事": "CCTV7",
"CCTV8电视剧": "CCTV8",
"CCTV9记录": "CCTV9",
"CCTV9纪录": "CCTV9",
"CCTV10科教": "CCTV10",
"CCTV11戏曲": "CCTV11",
"CCTV12社会与法": "CCTV12",
"CCTV13新闻": "CCTV13",
"CCTV新闻": "CCTV13",
"CCTV14少儿": "CCTV14",
"CCTV15音乐": "CCTV15",
"CCTV16奥林匹克": "CCTV16",
"CCTV17农业农村": "CCTV17",
"CCTV17农业": "CCTV17",
}
region_list = [
"广东",
"北京",
"湖南",
"湖北",
"浙江",
"上海",
"天津",
"江苏",
"山东",
"河南",
"河北",
"山西",
"陕西",
"安徽",
"重庆",
"福建",
"江西",
"辽宁",
"黑龙江",
"吉林",
"四川",
"云南",
"香港",
"内蒙古",
"甘肃",
"海南",
"云南",
]
origin_map = {
"hotel": "酒店源",
"multicast": "组播源",
"subscribe": "订阅源",
"online_search": "关键字源",
"whitelist": "白名单",
"local": "本地源",
}
ipv6_proxy = "http://www.ipv6proxy.net/go.php?u="
foodie_url = "http://www.foodieguide.com/iptvsearch/"
foodie_hotel_url = "http://www.foodieguide.com/iptvsearch/hoteliptv.php"
waiting_tip = "🔍️未找到结果文件,若已启动更新,请耐心等待更新完成..."