chore:hotel

This commit is contained in:
guorong.zheng 2024-08-27 15:13:37 +08:00
parent 2b3091a028
commit aa7236eddd
4 changed files with 17 additions and 14 deletions
config
updates

@ -9,7 +9,7 @@ online_search_page_num = 3
urls_limit = 15
open_keep_all = False
open_sort = True
open_ffmpeg = True
open_ffmpeg = False
response_time_weight = 0.5
resolution_weight = 0.5
recent_days = 30
@ -19,13 +19,13 @@ open_m3u_result = True
url_keywords_blacklist =
open_subscribe = True
subscribe_urls = 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
open_multicast = True
open_multicast = False
multicast_region_list = 广东
multicast_page_num = 5
multicast_page_num = 3
open_proxy = False
open_driver = True
open_hotel = True
open_hotel_tonkiang = True
open_hotel_tonkiang = False
open_hotel_fofa = True
hotel_region_list = 广东
hotel_page_num = 5

@ -19,15 +19,15 @@ def get_fofa_urls_from_region_list():
"""
Get the FOFA url from region
"""
region_list = config.get("Settings", "hotel_region_list").split(",")
# region_list = config.get("Settings", "hotel_region_list").split(",")
urls = []
region_url = getattr(fofa_map, "region_url")
if "all" in region_list or "全部" in region_list:
urls = [url for url in region_url.values() if url]
else:
for region in region_list:
if region in region_url:
urls.append(region_url[region])
# if "all" in region_list or "全部" in region_list:
urls = [url for url in region_url.values() if url]
# else:
# for region in region_list:
# if region in region_url:
# urls.append(region_url[region])
return urls

@ -243,7 +243,9 @@ async def get_channels_by_hotel(callback):
for result in search_region_result.values()
for url, _, _ in result
]
channels = await get_channels_by_subscribe_urls(urls, retry=False)
channels = await get_channels_by_subscribe_urls(
urls, retry=False, error_print=False
)
if not open_driver:
close_session()
pbar.close()

@ -13,7 +13,7 @@ timeout = 30
async def get_channels_by_subscribe_urls(
urls=None, multicast=False, retry=True, callback=None
urls=None, multicast=False, retry=True, error_print=True, callback=None
):
"""
Get the channels by subscribe urls
@ -81,7 +81,8 @@ async def get_channels_by_subscribe_urls(
else:
channels[name] = [value]
except Exception as e:
print(f"Error on {subscribe_url}: {e}")
if error_print:
print(f"Error on {subscribe_url}: {e}")
finally:
pbar.update()
remain = subscribe_urls_len - pbar.n