Skip to content

Commit

Permalink
Merge pull request #611 from Guovin/dev
Browse files Browse the repository at this point in the history
Release:v1.5.5
  • Loading branch information
Guovin authored Dec 2, 2024
2 parents 4ecd6ae + d919a42 commit 4ef8b5b
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 123 deletions.
251 changes: 178 additions & 73 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ ipv6_num = 5
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.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://github.moeyy.xyz/https://raw.githubusercontent.com/PizazzGY/TVBox/main/live.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
open_multicast = 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_fofa = True
multicast_region_list = 全部
multicast_page_num = 1
open_proxy = False
open_driver = True
open_hotel = True
open_driver = False
open_hotel = False
open_hotel_foodie = True
open_hotel_fofa = True
hotel_region_list = 全部
Expand Down
19 changes: 7 additions & 12 deletions config/demo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1247,18 +1247,6 @@ BTV纪实
宁夏少儿
宁夏电视台影视
石嘴山综合
安多卫视
门源综合
化隆综合
民和综合
兴海综合
大通电视台
湟中电视台
西宁新闻综合
西宁生活服务
青海经视
青海都市
青海综合

☘️吉林频道,#genre#
延边卫视
Expand Down Expand Up @@ -1372,6 +1360,13 @@ BTV纪实
门源综合
贵南综合
化隆综合
民和综合
兴海综合
大通电视台
湟中电视台
青海经视
青海都市
青海综合

☘️黑龙江频道,#genre#
黑龙江文体
Expand Down
Binary file modified updates/fofa/fofa_hotel_region_result.pkl
Binary file not shown.
59 changes: 26 additions & 33 deletions utils/speed.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from aiohttp import ClientSession, TCPConnector
from time import time
import asyncio
import re
from utils.config import config
import utils.constants as constants
from utils.tools import is_ipv6, remove_cache_info, get_resolution_value, get_logger
import subprocess
from time import time

import yt_dlp
from concurrent.futures import ProcessPoolExecutor
import functools
from aiohttp import ClientSession, TCPConnector

import utils.constants as constants
from utils.config import config
from utils.tools import is_ipv6, remove_cache_info, get_resolution_value, get_logger

logger = get_logger(constants.log_path)

Expand All @@ -34,34 +34,27 @@ async def get_speed_yt_dlp(url, timeout=config.sort_timeout):
Get the speed of the url by yt_dlp
"""
try:
async with asyncio.timeout(timeout + 2):
start_time = time()
loop = asyncio.get_running_loop()
with ProcessPoolExecutor() as exc:
info = await loop.run_in_executor(
exc, functools.partial(get_info_yt_dlp, url, timeout)
)
fps = (
int(round((time() - start_time) * 1000))
if len(info)
else float("inf")
)
resolution = (
f"{info['width']}x{info['height']}"
if "width" in info and "height" in info
else None
)
return (fps, resolution)
start_time = time()
info = await asyncio.wait_for(
asyncio.to_thread(get_info_yt_dlp, url, timeout), timeout=timeout
)
fps = int(round((time() - start_time) * 1000)) if len(info) else float("inf")
resolution = (
f"{info['width']}x{info['height']}"
if "width" in info and "height" in info
else None
)
return fps, resolution
except:
return (float("inf"), None)
return float("inf"), None


async def get_speed_requests(url, timeout=config.sort_timeout, proxy=None):
"""
Get the speed of the url by requests
"""
async with ClientSession(
connector=TCPConnector(verify_ssl=False), trust_env=True
connector=TCPConnector(verify_ssl=False), trust_env=True
) as session:
start = time()
end = None
Expand Down Expand Up @@ -153,7 +146,7 @@ async def check_stream_speed(url_info):
if frame is None or frame == float("inf"):
return float("inf")
url_info[2] = resolution
return (url_info, frame)
return url_info, frame
except Exception as e:
print(e)
return float("inf")
Expand All @@ -164,7 +157,7 @@ async def check_stream_speed(url_info):

async def get_speed(url, ipv6_proxy=None, callback=None):
"""
Get the speed of the url
Get the speed (response time and resolution) of the url
"""
try:
cache_key = None
Expand All @@ -177,14 +170,14 @@ async def get_speed(url, ipv6_proxy=None, callback=None):
if cache_key in speed_cache:
return speed_cache[cache_key][0]
if ipv6_proxy and url_is_ipv6:
speed = 0
speed = (0, None)
else:
speed = await get_speed_yt_dlp(url)
if cache_key and cache_key not in speed_cache:
speed_cache[cache_key] = speed
return speed
except:
return float("inf")
return float("inf"), None
finally:
if callback:
callback()
Expand Down Expand Up @@ -224,8 +217,8 @@ def combined_key(item):
else:
resolution_value = get_resolution_value(resolution) if resolution else 0
return (
config.response_time_weight * response_time
- config.resolution_weight * resolution_value
config.response_time_weight * response_time
- config.resolution_weight * resolution_value
)

filter_data.sort(key=combined_key)
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.5.4",
"version": "1.5.5",
"name": "IPTV-API"
}

0 comments on commit 4ef8b5b

Please sign in to comment.