constants.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import os
  2. import re
  3. config_dir = "config"
  4. output_dir = "output"
  5. live_path = os.path.join(config_dir, "live")
  6. hls_path = os.path.join(config_dir, "hls")
  7. alias_path = os.path.join(config_dir, "alias.txt")
  8. epg_path = os.path.join(config_dir, "epg.txt")
  9. whitelist_path = os.path.join(config_dir, "whitelist.txt")
  10. blacklist_path = os.path.join(config_dir, "blacklist.txt")
  11. subscribe_path = os.path.join(config_dir, "subscribe.txt")
  12. epg_result_path = os.path.join(output_dir, "epg/epg.xml")
  13. epg_gz_result_path = os.path.join(output_dir, "epg/epg.gz")
  14. ipv4_result_path = os.path.join(output_dir, "ipv4/result.txt")
  15. ipv6_result_path = os.path.join(output_dir, "ipv6/result.txt")
  16. live_result_path = os.path.join(output_dir, "live.txt")
  17. live_ipv4_result_path = os.path.join(output_dir, "ipv4/live.txt")
  18. live_ipv6_result_path = os.path.join(output_dir, "ipv6/live.txt")
  19. rtmp_data_path = os.path.join(output_dir, "data/rtmp.db")
  20. hls_result_path = os.path.join(output_dir, "hls.txt")
  21. hls_ipv4_result_path = os.path.join(output_dir, "ipv4/hls.txt")
  22. hls_ipv6_result_path = os.path.join(output_dir, "ipv6/hls.txt")
  23. cache_path = os.path.join(output_dir, "data/cache.pkl.gz")
  24. result_log_path = os.path.join(output_dir, "log/result.log")
  25. log_path = os.path.join(output_dir, "log/log.log")
  26. url_host_pattern = re.compile(r"((https?|rtmp|rtsp)://)?([^:@/]+(:[^:@/]*)?@)?(\[[0-9a-fA-F:]+]|([\w-]+\.)+[\w-]+)")
  27. url_pattern = re.compile(
  28. r"(?P<url>" + url_host_pattern.pattern + r"(?:\S*?(?=\?$|\?\$|$)|[^\s?]*))")
  29. rt_url_pattern = re.compile(r"^(rtmp|rtsp)://.*$")
  30. rtp_pattern = re.compile(r"^(?P<name>[^,,]+)[,,]?(?P<url>rtp://.*)$")
  31. demo_txt_pattern = re.compile(r"^(?P<name>[^,,]+)[,,]?(?!#genre#)" + r"(" + url_pattern.pattern + r")?")
  32. txt_pattern = re.compile(r"^(?P<name>[^,,]+)[,,](?!#genre#)" + r"(" + url_pattern.pattern + r")")
  33. multiline_txt_pattern = re.compile(r"^(?P<name>[^,,]+)[,,](?!#genre#)" + r"(" + url_pattern.pattern + r")",
  34. re.MULTILINE)
  35. m3u_pattern = re.compile(
  36. r"^#EXTINF:-1[\s+,,](?P<attributes>[^,,]+)[,,](?P<name>.*?)\n" + r"(" + url_pattern.pattern + r")")
  37. multiline_m3u_pattern = re.compile(
  38. r"^#EXTINF:-1[\s+,,](?P<attributes>[^,,]+)[,,](?P<name>.*?)\n(?P<options>(#EXTVLCOPT:.*\n)*?)" + r"(" + url_pattern.pattern + r")",
  39. re.MULTILINE)
  40. key_value_pattern = re.compile(r'(?P<key>\w+)=(?P<value>\S+)')
  41. sub_pattern = re.compile(
  42. r"-|_|\((.*?)\)|((.*?))|\[(.*?)]|「(.*?)」| |||频道|普清|标清|高清|HD|hd|超清|超高|超高清|中央|央视|电视台|台|电信|联通|移动")
  43. replace_dict = {
  44. "plus": "+",
  45. "PLUS": "+",
  46. "+": "+",
  47. }
  48. region_list = [
  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. origin_map = {
  78. "hotel": "酒店源",
  79. "multicast": "组播源",
  80. "subscribe": "订阅源",
  81. "online_search": "关键字源",
  82. "whitelist": "白名单",
  83. "local": "本地源",
  84. }
  85. ipv6_proxy = "http://www.ipv6proxy.net/go.php?u="
  86. foodie_url = "http://www.foodieguide.com/iptvsearch/"
  87. foodie_hotel_url = "http://www.foodieguide.com/iptvsearch/hoteliptv.php"
  88. waiting_tip = "🔍️未找到结果文件,若已启动更新,请耐心等待更新完成..."