From e06b8af748a6785cdbff5a1a2c84c1ec32a56ae0 Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Mon, 2 Dec 2024 17:22:54 +0800 Subject: [PATCH] chore:config --- config/config.ini | 10 +++++----- updates/fofa/request.py | 40 +++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/config/config.ini b/config/config.ini index 81a9520c7f..b01a4e55fe 100644 --- a/config/config.ini +++ b/config/config.ini @@ -24,15 +24,15 @@ open_m3u_result = True url_keywords_blacklist = epg.pw,skype.serv00.net,iptv.yjxfz.com,live-hls-web-ajb.getaj.net,live.goodiptv.club,hc73k3dhwo5gfkt.wcetv.com,stream1.freetv.fun,zw9999.cnstream.top open_subscribe = True subscribe_urls = https://live.zbds.top/tv/iptv6.txt,https://live.zbds.top/tv/iptv4.txt,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://ghp.ci/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://ghp.ci/https://raw.githubusercontent.com/xzw832/cmys/main/S_CCTV.txt,https://ghp.ci/https://raw.githubusercontent.com/xzw832/cmys/main/S_weishi.txt,http://itv.22m.top/ITVBox/tv/tvonline.txt,https://ghp.ci//https://raw.githubusercontent.com/asdjkl6/tv/tv/.m3u/整套直播源/测试/整套直播源/l.txt,https://ghp.ci//https://raw.githubusercontent.com/asdjkl6/tv/tv/.m3u/整套直播源/测试/整套直播源/kk.txt -open_multicast = False -open_multicast_foodie = True +open_multicast = True +open_multicast_foodie = False open_multicast_fofa = True multicast_region_list = 全部 multicast_page_num = 1 open_proxy = False -open_driver = False -open_hotel = False -open_hotel_foodie = True +open_driver = True +open_hotel = True +open_hotel_foodie = False open_hotel_fofa = True hotel_region_list = 全部 hotel_page_num = 1 diff --git a/updates/fofa/request.py b/updates/fofa/request.py index 26b31951ac..0d3b9f15f6 100644 --- a/updates/fofa/request.py +++ b/updates/fofa/request.py @@ -1,19 +1,21 @@ -from tqdm.asyncio import tqdm_asyncio +import pickle +import re +import threading +from collections import defaultdict +from concurrent.futures import ThreadPoolExecutor, as_completed from time import time + from requests import get -from concurrent.futures import ThreadPoolExecutor, as_completed +from tqdm.asyncio import tqdm_asyncio + import updates.fofa.fofa_map as fofa_map -import re -from utils.config import config import utils.constants as constants -from utils.retry import retry_func +from requests_custom.utils import get_source_requests, close_session +from updates.proxy import get_proxy, get_proxy_next from utils.channel import format_channel_name +from utils.config import config +from utils.retry import retry_func from utils.tools import merge_objects, get_pbar_remaining, add_url_info, resource_path -from updates.proxy import get_proxy, get_proxy_next -from requests_custom.utils import get_source_requests, close_session -from collections import defaultdict -import pickle -import threading def get_fofa_urls_from_region_list(): @@ -44,10 +46,10 @@ def update_fofa_region_result_tmp(result, multicast=False): tmp_result = get_fofa_region_result_tmp(multicast=multicast) total_result = merge_objects(tmp_result, result) with open( - resource_path( - f"updates/fofa/fofa_{'multicast' if multicast else 'hotel'}_region_result.pkl" - ), - "wb", + resource_path( + f"updates/fofa/fofa_{'multicast' if multicast else 'hotel'}_region_result.pkl" + ), + "wb", ) as file: pickle.dump(total_result, file) @@ -55,10 +57,10 @@ def update_fofa_region_result_tmp(result, multicast=False): def get_fofa_region_result_tmp(multicast: False): try: with open( - resource_path( - f"updates/fofa/fofa_{'multicast' if multicast else 'hotel'}_region_result.pkl" - ), - "rb", + resource_path( + f"updates/fofa/fofa_{'multicast' if multicast else 'hotel'}_region_result.pkl" + ), + "rb", ) as file: return pickle.load(file) except: @@ -119,7 +121,7 @@ def process_fofa_channels(fofa_info): page_source = retry_func( lambda: get_source_requests(fofa_url), name=fofa_url ) - if "禁止访问" in page_source or "资源访问每天限制" in page_source: + if any(keyword in page_source for keyword in ["访问异常", "禁止访问", "资源访问每天限制"]): cancel_event.set() raise ValueError("Limited access to fofa page") fofa_source = re.sub(r"", "", page_source, flags=re.DOTALL)