Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore #614

Merged
merged 2 commits into from
Dec 2, 2024
Merged

chore #614

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 21 additions & 19 deletions updates/fofa/request.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down Expand Up @@ -44,21 +46,21 @@ 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)


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:
Expand Down Expand Up @@ -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)
Expand Down