Skip to content

Commit

Permalink
Merge branch 'master' into gd
Browse files Browse the repository at this point in the history
# Conflicts:
#	updates/fofa/fofa_multicast_region_result.pkl
  • Loading branch information
Guovin committed Nov 12, 2024
2 parents 9f76468 + 5099e45 commit e8e7f8a
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 162 deletions.
4 changes: 2 additions & 2 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ url_keywords_blacklist =
open_subscribe = True
subscribe_urls = https://live.fanmingming.com/tv/m3u/ipv6.m3u,https://ghp.ci/https://raw.githubusercontent.com/joevess/IPTV/main/home.m3u8,https://aktv.top/live.txt,http://175.178.251.183:6689/live.txt,https://ghproxy.net/https://raw.githubusercontent.com/kimwang1978/collect-tv-txt/main/merged_output.txt,https://m3u.ibert.me/txt/fmml_dv6.txt,https://m3u.ibert.me/txt/o_cn.txt,https://m3u.ibert.me/txt/j_iptv.txt,https://github.moeyy.xyz/https://raw.githubusercontent.com/PizazzGY/TVBox/main/live.txt,https://ghproxy.net/https://raw.githubusercontent.com/xzw832/cmys/main/S_CCTV.txt,https://ghproxy.net/https://raw.githubusercontent.com/xzw832/cmys/main/S_weishi.txt,http://itv.22m.top/ITVBox/tv/tvonline.txt
open_multicast = True
open_multicast_tonkiang = True
open_multicast_foodie = True
open_multicast_fofa = True
multicast_region_list = 全部
multicast_page_num = 1
open_proxy = False
open_driver = True
open_hotel = True
open_hotel_tonkiang = True
open_hotel_foodie = True
open_hotel_fofa = True
hotel_region_list = 全部
hotel_page_num = 1
Expand Down
94 changes: 47 additions & 47 deletions docs/config.md

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions docs/config_en.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self):
self.tasks = []
self.channel_items = {}
self.hotel_fofa_result = {}
self.hotel_tonkiang_result = {}
self.hotel_foodie_result = {}
self.multicast_result = {}
self.subscribe_result = {}
self.online_search_result = {}
Expand All @@ -84,7 +84,7 @@ async def visit_page(self, channel_names=None):
tasks_config = [
("hotel_fofa", get_channels_by_fofa, "hotel_fofa_result"),
("multicast", get_channels_by_multicast, "multicast_result"),
("hotel_tonkiang", get_channels_by_hotel, "hotel_tonkiang_result"),
("hotel_foodie", get_channels_by_hotel, "hotel_foodie_result"),
("subscribe", get_channels_by_subscribe_urls, "subscribe_result"),
(
"online_search",
Expand All @@ -95,7 +95,7 @@ async def visit_page(self, channel_names=None):

for setting, task_func, result_attr in tasks_config:
if (
setting == "hotel_tonkiang" or setting == "hotel_fofa"
setting == "hotel_foodie" or setting == "hotel_fofa"
) and config.open_hotel == False:
continue
if config.open_method[setting]:
Expand All @@ -104,7 +104,7 @@ async def visit_page(self, channel_names=None):
task = asyncio.create_task(
task_func(subscribe_urls, callback=self.update_progress)
)
elif setting == "hotel_tonkiang" or setting == "hotel_fofa":
elif setting == "hotel_foodie" or setting == "hotel_fofa":
task = asyncio.create_task(task_func(callback=self.update_progress))
else:
task = asyncio.create_task(
Expand Down Expand Up @@ -152,7 +152,7 @@ async def main(self):
self.channel_data,
self.hotel_fofa_result,
self.multicast_result,
self.hotel_tonkiang_result,
self.hotel_foodie_result,
self.subscribe_result,
self.online_search_result,
)
Expand Down
18 changes: 9 additions & 9 deletions tkinter_ui/hotel.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def init_ui(self, root):
frame_hotel_mode, text="工作模式:", width=9
)
self.open_hotel_mode_label.pack(side=tk.LEFT, padx=4, pady=8)
self.open_hotel_tonkiang_var = tk.BooleanVar(value=config.open_hotel_tonkiang)
self.open_hotel_tonkiang_checkbutton = ttk.Checkbutton(
self.open_hotel_foodie_var = tk.BooleanVar(value=config.open_hotel_foodie)
self.open_hotel_foodie_checkbutton = ttk.Checkbutton(
frame_hotel_mode,
variable=self.open_hotel_tonkiang_var,
variable=self.open_hotel_foodie_var,
onvalue=True,
offvalue=False,
command=self.update_open_hotel_tonkiang,
text="Tonkiang",
command=self.update_open_hotel_foodie,
text="Foodie",
)
self.open_hotel_tonkiang_checkbutton.pack(side=tk.LEFT, padx=4, pady=8)
self.open_hotel_foodie_checkbutton.pack(side=tk.LEFT, padx=4, pady=8)

self.open_hotel_fofa_var = tk.BooleanVar(value=config.open_hotel_fofa)
self.open_hotel_fofa_checkbutton = ttk.Checkbutton(
Expand Down Expand Up @@ -88,9 +88,9 @@ def init_ui(self, root):
def update_open_hotel(self):
config.set("Settings", "open_hotel", str(self.open_hotel_var.get()))

def update_open_hotel_tonkiang(self):
def update_open_hotel_foodie(self):
config.set(
"Settings", "open_hotel_tonkiang", str(self.open_hotel_tonkiang_var.get())
"Settings", "open_hotel_foodie", str(self.open_hotel_foodie_var.get())
)

def update_open_hotel_fofa(self):
Expand All @@ -109,7 +109,7 @@ def update_page_num(self, event):
def change_entry_state(self, state):
for entry in [
"open_hotel_checkbutton",
"open_hotel_tonkiang_checkbutton",
"open_hotel_foodie_checkbutton",
"open_hotel_fofa_checkbutton",
"region_list_combo",
"page_num_entry",
Expand Down
22 changes: 11 additions & 11 deletions tkinter_ui/multicast.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ def init_ui(self, root):
frame_multicast_mode, text="工作模式:", width=9
)
self.open_multicast_mode_label.pack(side=tk.LEFT, padx=4, pady=8)
self.open_multicast_tonkiang_var = tk.BooleanVar(
value=config.open_multicast_tonkiang
self.open_multicast_foodie_var = tk.BooleanVar(
value=config.open_multicast_foodie
)
self.open_multicast_tonkiang_checkbutton = ttk.Checkbutton(
self.open_multicast_foodie_checkbutton = ttk.Checkbutton(
frame_multicast_mode,
variable=self.open_multicast_tonkiang_var,
variable=self.open_multicast_foodie_var,
onvalue=True,
offvalue=False,
command=self.update_open_multicast_tonkiang,
text="Tonkiang",
command=self.update_open_multicast_foodie,
text="Foodie",
)
self.open_multicast_tonkiang_checkbutton.pack(side=tk.LEFT, padx=4, pady=8)
self.open_multicast_foodie_checkbutton.pack(side=tk.LEFT, padx=4, pady=8)

self.open_multicast_fofa_var = tk.BooleanVar(value=config.open_multicast_fofa)
self.open_multicast_fofa_checkbutton = ttk.Checkbutton(
Expand Down Expand Up @@ -107,11 +107,11 @@ def init_ui(self, root):
def update_open_multicast(self):
config.set("Settings", "open_multicast", str(self.open_multicast_var.get()))

def update_open_multicast_tonkiang(self):
def update_open_multicast_foodie(self):
config.set(
"Settings",
"open_multicast_tonkiang",
str(self.open_multicast_tonkiang_var.get()),
"open_multicast_foodie",
str(self.open_multicast_foodie_var.get()),
)

def update_open_multicast_fofa(self):
Expand All @@ -132,7 +132,7 @@ def update_page_num(self, event):
def change_entry_state(self, state):
for entry in [
"open_multicast_checkbutton",
"open_multicast_tonkiang_checkbutton",
"open_multicast_foodie_checkbutton",
"open_multicast_fofa_checkbutton",
"region_list_combo",
"page_num_entry",
Expand Down
4 changes: 2 additions & 2 deletions tkinter_ui/tkinter_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def save_config(self):
"open_subscribe": self.subscribe_ui.open_subscribe_var.get(),
"subscribe_urls": self.subscribe_ui.subscribe_urls_text.get(1.0, tk.END),
"open_multicast": self.multicast_ui.open_multicast_var.get(),
"open_multicast_tonkiang": self.multicast_ui.open_multicast_tonkiang_var.get(),
"open_multicast_foodie": self.multicast_ui.open_multicast_foodie_var.get(),
"open_multicast_fofa": self.multicast_ui.open_multicast_fofa_var.get(),
"multicast_region_list": self.multicast_ui.region_list_combo.get(),
"multicast_page_num": self.multicast_ui.page_num_entry.get(),
"open_hotel": self.hotel_ui.open_hotel_var.get(),
"open_hotel_tonkiang": self.hotel_ui.open_hotel_tonkiang_var.get(),
"open_hotel_foodie": self.hotel_ui.open_hotel_foodie_var.get(),
"open_hotel_fofa": self.hotel_ui.open_hotel_fofa_var.get(),
"hotel_region_list": self.hotel_ui.region_list_combo.get(),
"hotel_page_num": self.hotel_ui.page_num_entry.get(),
Expand Down
Binary file modified updates/fofa/fofa_hotel_region_result.pkl
Binary file not shown.
Binary file modified updates/fofa/fofa_multicast_region_result.pkl
Binary file not shown.
13 changes: 7 additions & 6 deletions updates/hotel/request.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from utils.config import config
import utils.constants as constants
from utils.channel import (
get_results_from_multicast_soup,
get_results_from_multicast_soup_requests,
Expand Down Expand Up @@ -28,7 +29,7 @@ async def get_channels_by_hotel(callback=None):
Get the channels by multicase
"""
channels = {}
pageUrl = "http://www.foodieguide.com/iptvsearch/hoteliptv.php"
pageUrl = constants.foodie_hotel_url
proxy = None
open_proxy = config.open_proxy
open_driver = config.open_driver
Expand All @@ -51,7 +52,7 @@ def process_region_by_hotel(region):
try:
retry_func(
lambda: driver.get(pageUrl),
name=f"Tonkiang hotel search:{name}",
name=f"Foodie hotel search:{name}",
)
except Exception as e:
if open_proxy:
Expand All @@ -68,7 +69,7 @@ def process_region_by_hotel(region):
try:
page_soup = retry_func(
lambda: get_soup_requests(pageUrl, data=post_form, proxy=proxy),
name=f"Tonkiang hotel search:{name}",
name=f"Foodie hotel search:{name}",
)
except Exception as e:
if open_proxy:
Expand Down Expand Up @@ -144,15 +145,15 @@ def process_region_by_hotel(region):
pbar.update()
if callback:
callback(
f"正在获取Tonkiang酒店源, 剩余{region_list_len - pbar.n}个地区待查询, 预计剩余时间: {get_pbar_remaining(n=pbar.n, total=pbar.total, start_time=start_time)}",
f"正在获取Foodie酒店源, 剩余{region_list_len - pbar.n}个地区待查询, 预计剩余时间: {get_pbar_remaining(n=pbar.n, total=pbar.total, start_time=start_time)}",
int((pbar.n / region_list_len) * 100),
)
return info_list

region_list_len = len(region_list)
pbar = tqdm_asyncio(total=region_list_len, desc="Tonkiang hotel search")
pbar = tqdm_asyncio(total=region_list_len, desc="Foodie hotel search")
if callback:
callback(f"正在获取Tonkiang酒店源, 共{region_list_len}个地区", 0)
callback(f"正在获取Foodie酒店源, 共{region_list_len}个地区", 0)
search_region_result = defaultdict(list)
with ThreadPoolExecutor(max_workers=3) as executor:
futures = {
Expand Down
9 changes: 5 additions & 4 deletions updates/multicast/request.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from utils.config import config
import utils.constants as constants
from utils.channel import (
get_results_from_multicast_soup,
get_results_from_multicast_soup_requests,
Expand Down Expand Up @@ -32,7 +33,7 @@ async def get_channels_by_multicast(names, callback=None):
Get the channels by multicase
"""
channels = {}
pageUrl = "http://www.foodieguide.com/iptvsearch/hoteliptv.php"
pageUrl = constants.foodie_hotel_url
proxy = None
open_proxy = config.open_proxy
open_driver = config.open_driver
Expand Down Expand Up @@ -148,17 +149,17 @@ def process_channel_by_multicast(region, type):
pbar.update()
if callback:
callback(
f"正在进行Tonkiang组播更新, 剩余{region_type_list_len - pbar.n}个地区待查询, 预计剩余时间: {get_pbar_remaining(n=pbar.n, total=pbar.total, start_time=start_time)}",
f"正在进行Foodie组播更新, 剩余{region_type_list_len - pbar.n}个地区待查询, 预计剩余时间: {get_pbar_remaining(n=pbar.n, total=pbar.total, start_time=start_time)}",
int((pbar.n / region_type_list_len) * 100),
)
return {"region": region, "type": type, "data": info_list}

if config.open_multicast_tonkiang:
if config.open_multicast_foodie:
region_type_list_len = len(region_type_list)
pbar = tqdm_asyncio(total=region_type_list_len, desc="Multicast search")
if callback:
callback(
f"正在进行Tonkiang组播更新, {len(names)}个频道, 共{region_type_list_len}个地区",
f"正在进行Foodie组播更新, {len(names)}个频道, 共{region_type_list_len}个地区",
0,
)
start_time = time()
Expand Down
22 changes: 1 addition & 21 deletions updates/online_search/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,12 @@
from requests_custom.utils import get_soup_requests, close_session


async def use_accessible_url(callback):
"""
Check if the url is accessible
"""
callback(f"正在获取最优的关键字搜索节点", 0)
baseUrl1 = "http://www.foodieguide.com/iptvsearch/"
baseUrl2 = "http://tonkiang.us/"
task1 = create_task(get_speed(baseUrl1, timeout=config.request_timeout))
task2 = create_task(get_speed(baseUrl2, timeout=config.request_timeout))
task_results = await gather(task1, task2)
callback(f"获取关键字搜索节点完成", 100)
if task_results[0] == float("inf") and task_results[1] == float("inf"):
return None
if task_results[0] < task_results[1]:
return baseUrl1
else:
return baseUrl2


async def get_channels_by_online_search(names, callback=None):
"""
Get the channels by online search
"""
channels = {}
# pageUrl = await use_accessible_url(callback)
pageUrl = "http://www.foodieguide.com/iptvsearch/"
pageUrl = constants.foodie_url
if not pageUrl:
return channels
proxy = None
Expand Down
4 changes: 2 additions & 2 deletions utils/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def append_total_data(
data,
hotel_fofa_result=None,
multicast_result=None,
hotel_tonkiang_result=None,
hotel_foodie_result=None,
subscribe_result=None,
online_search_result=None,
):
Expand All @@ -558,7 +558,7 @@ def append_total_data(
total_result = [
("hotel_fofa", hotel_fofa_result),
("multicast", multicast_result),
("hotel_tonkiang", hotel_tonkiang_result),
("hotel_foodie", hotel_foodie_result),
("subscribe", subscribe_result),
("online_search", online_search_result),
]
Expand Down
12 changes: 6 additions & 6 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def open_hotel_fofa(self):
return self.config.getboolean("Settings", f"open_hotel_fofa", fallback=True)

@property
def open_hotel_tonkiang(self):
return self.config.getboolean("Settings", f"open_hotel_tonkiang", fallback=True)
def open_hotel_foodie(self):
return self.config.getboolean("Settings", f"open_hotel_foodie", fallback=True)

@property
def open_multicast(self):
Expand All @@ -208,9 +208,9 @@ def open_multicast_fofa(self):
return self.config.getboolean("Settings", f"open_multicast_fofa", fallback=True)

@property
def open_multicast_tonkiang(self):
def open_multicast_foodie(self):
return self.config.getboolean(
"Settings", f"open_multicast_tonkiang", fallback=True
"Settings", f"open_multicast_foodie", fallback=True
)

@property
Expand All @@ -225,9 +225,9 @@ def open_method(self):
"multicast": self.open_multicast,
"online_search": self.open_online_search,
"hotel_fofa": self.open_hotel_fofa,
"hotel_tonkiang": self.open_hotel_tonkiang,
"hotel_foodie": self.open_hotel_foodie,
"multicast_fofa": self.open_multicast_fofa,
"multicast_tonkiang": self.open_multicast_tonkiang,
"multicast_foodie": self.open_multicast_foodie,
}

@property
Expand Down
4 changes: 4 additions & 0 deletions utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@
}

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"

0 comments on commit e8e7f8a

Please sign in to comment.