From cb545885d47b5a9b030e3dbde274d6f98625b2ca Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Mon, 1 Apr 2024 16:36:32 +0800 Subject: [PATCH] release:v1.0.1 --- CHANGELOG.md | 95 ++++++++++++++++++---------------------------------- main.py | 17 +--------- utils.py | 23 +++++++++---- version.json | 2 +- 4 files changed, 52 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ca3815ca7..87cd7aaf84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,113 +1,84 @@ # Changelog +## v1.0.1 + +### 2024/4/1 + +- 适配接口提供方变更,调整接口链接与信息提取方法(Adapt to changes from the interface provider, adjust the interface link and information extraction method) + +--- + ## v1.0.0 ### 2024/3/30 -- 修复工作流读取配置与更新文件对比问题 +- 修复工作流读取配置与更新文件对比问题(Fix the issue of workflow reading configuration and comparing updated files) --- -- Fix the issue of workflow reading configuration and comparing updated files - ### 2024/3/29 -- 修复用户专属配置更新结果失败 +- 修复用户专属配置更新结果失败(Fix user specific configuration update failure) --- -- Fix user specific configuration update failure - ### 2024/3/26 -- 新增快速上手-详细教程 -- 新增以 releases 发布版本更新信息 +- 新增快速上手-详细教程(Add a Quick Start - detailed tutorial) +- 新增以 releases 发布版本更新信息(Add release notes for version updates using releases) --- -- Add a Quick Start - detailed tutorial -- Add release notes for version updates using releases - ### 2024/3/25 -- 增加代码防覆盖,用户可使用 user\_作为文件前缀以区分独有配置,可避免在合并更新时本地代码被上游仓库代码覆盖,如 user_config.py、user_demo.txt、user_result.txt +- 增加代码防覆盖,用户可使用 user\_作为文件前缀以区分独有配置,可避免在合并更新时本地代码被上游仓库代码覆盖,如 user_config.py、user_demo.txt、user_result.txt(Add code anti-overwriting. Users can use user\_ as the file prefix to distinguish unique configurations. This prevents local codes from being overwritten by upstream repository codes, such as user_config.py, user_demo.txt, and user_result.txt, when merging updates) --- -- Add code anti-overwriting. Users can use user\_ as the file prefix to distinguish unique configurations. This prevents local codes from being overwritten by upstream repository codes, such as user_config.py, user_demo.txt, and user_result.txt, when merging updates - ### 2024/3/21 -- 修复潜在的更新文件追踪失效,导致更新失败 -- 调整最近更新获取时间默认为 30 天 -- 优化最近更新接口筛选,当筛选后不足指定接口个数时,将使用其它时间范围的可用接口补充 -- 优化珠江、CCTV 频道匹配问题 -- 移除推送实时触发更新 +- 修复潜在的更新文件追踪失效,导致更新失败(Fixed potential tracking failure of updated files, leading to update failure) +- 调整最近更新获取时间默认为 30 天(Adjusted the default recent update retrieval time to 30 days) +- 优化最近更新接口筛选,当筛选后不足指定接口个数时,将使用其它时间范围的可用接口补充(Optimized the recent update interface filter, when the number of interfaces is insufficient after filtering, other time range available interfaces will be used for supplementation) +- 优化珠江、CCTV 频道匹配问题(Optimized the matching problem of Zhujiang and CCTV channels) +- 移除推送实时触发更新(Removed push real-time trigger update) --- -- Fixed potential tracking failure of updated files, leading to update failure -- Adjusted the default recent update retrieval time to 30 days -- Optimized the recent update interface filter, when the number of interfaces is insufficient after filtering, other time range available interfaces will be used for supplementation -- Optimized the matching problem of Zhujiang and CCTV channels -- Removed push real-time trigger update - ### 2024/3/18 -- 新增配置项:ipv_type,用于过滤 ipv4、ipv6 接口类型 -- 优化文件更新逻辑,避免更新失效引起文件丢失 -- 调整分页获取默认值:关注频道获取 6 页,常规频道获取 4 页,以提升更新速度 -- 增加接口日志文件 result.log 输出 -- 修复权重排序异常 +- 新增配置项:ipv_type,用于过滤 ipv4、ipv6 接口类型(Added configuration item: ipv_type, used to filter ipv4, ipv6 interface types) +- 优化文件更新逻辑,避免更新失效引起文件丢失(Optimized file update logic to prevent file loss caused by update failure) +- 调整分页获取默认值:关注频道获取 6 页,常规频道获取 4 页,以提升更新速度(Adjusted the default value for pagination: fetch 6 pages for followed channels, 4 pages for regular channels, to improve update speed) +- 增加接口日志文件 result.log 输出(Added output of interface log file result.log) +- 修复权重排序异常(Fixed weight sorting anomaly) --- -- Added configuration item: ipv_type, used to filter ipv4, ipv6 interface types -- Optimized file update logic to prevent file loss caused by update failure -- Adjusted the default value for pagination: fetch 6 pages for followed channels, 4 pages for regular channels, to improve update speed -- Added output of interface log file result.log -- Fixed weight sorting anomaly - ### 2024/3/15 -- 优化代码结构 -- 新增接口日志,记录详细质量指标 -- 新增可手动运行工作流触发更新 +- 优化代码结构(Optimize code structure) +- 新增接口日志,记录详细质量指标(Added interface logs to record detailed quality indicators) +- 新增可手动运行工作流触发更新(Added manual workflows to trigger updates) --- -- Optimize code structure -- Added interface logs to record detailed quality indicators -- Added manual workflows to trigger updates - ### 2024/3/13 -- 增加配置项:recent_days,筛选获取最近时间范围内更新的接口,默认最近 60 天 -- 调整默认值:关注频道获取 8 页,常规频道获取 5 页 +- 增加配置项:recent_days,筛选获取最近时间范围内更新的接口,默认最近 60 天(Added configuration item: recent_days, a filter to get the most recently updated interfaces, default to the last 60 days) +- 调整默认值:关注频道获取 8 页,常规频道获取 5 页(Adjusted default values: fetch 8 pages for followed channels, 5 pages for regular channels) --- -- Added configuration item: recent_days, a filter to get the most recently updated interfaces, default to the last 60 days -- Adjusted default values: fetch 8 pages for followed channels, 5 pages for regular channels - ### 2024/3/6 -- 更新文件代理说明 +- 更新文件代理说明(Update file proxy description) --- -- Update file proxy description - ### 2024/3/4 -- 增加配置项:响应时间与分辨率权重值 -- 移除配置项:是否过滤无效接口,始终执行过滤 -- 移除按日期排序,采用响应时间与分辨率作为排序规则 -- 更新 README:增加修改更新频率、文件代理说明、更新日志 - ---- - -- Added configuration items: response time and resolution weight values -- Removed configuration items: whether to filter invalid interfaces, always perform filtering -- Removed sorting by date, using response time and resolution as sorting rules -- Updated README: added modification update frequency, file proxy description, update log +- 增加配置项:响应时间与分辨率权重值(Added configuration items: response time and resolution weight values) +- 移除配置项:是否过滤无效接口,始终执行过滤(Removed configuration items: whether to filter invalid interfaces, always perform filtering) +- 移除按日期排序,采用响应时间与分辨率作为排序规则(Removed sorting by date, using response time and resolution as sorting rules) +- 更新 README:增加修改更新频率、文件代理说明、更新日志(Updated README: added modification update frequency, file proxy description, update log) diff --git a/main.py b/main.py index d63a2ec9fd..c68e8a192a 100644 --- a/main.py +++ b/main.py @@ -79,9 +79,7 @@ async def visitPage(self, channelItems): if tables_div else [] ) - if not any( - result.find("div", class_="m3u8") for result in results - ): + if not any(result.find("tbody") for result in results): break for result in results: try: @@ -125,21 +123,8 @@ def main(self): if os.path.exists("user_" + config.source_file) else "result.log" ) - print("Final file:", user_final_file) - print("Log file:", user_log_file) - - def print_file_content(file_name): - print(f"Content of {file_name}:") - with open(file_name, "r") as file: - print(file.read()) - - print_file_content("result_new.txt") - print_file_content("result_new.log") updateFile(user_final_file, "result_new.txt") updateFile(user_log_file, "result_new.log") - print("Updated files successfully!") - print_file_content(user_final_file) - print_file_content(user_log_file) UpdateSource().main() diff --git a/utils.py b/utils.py index d463ced672..9f74fdf75b 100644 --- a/utils.py +++ b/utils.py @@ -74,12 +74,23 @@ def getUrlInfo(result): """ Get the url, date and resolution """ - m3u8_div = result.find("div", class_="m3u8") - url = m3u8_div.text.strip() if m3u8_div else None - info_div = m3u8_div.find_next_sibling("div") if m3u8_div else None - date = resolution = None - if info_div: - info_text = info_div.text.strip() + url = date = resolution = None + tbodies = result.find_all("tbody") + for tbody in tbodies: + tds = tbody.find_all("td") + for td in tds: + td_text = td.get_text(strip=True) + url_match = re.search( + r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", + td_text, + ) + if url_match: + url = url_match.group() + break + if url: + break + info_text = result.find_all("div")[-1].get_text(strip=True) + if info_text: date, resolution = ( (info_text.partition(" ")[0] if info_text.partition(" ")[0] else None), ( diff --git a/version.json b/version.json index 688e939808..24d3a2ff41 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "1.0.0" + "version": "1.0.1" } \ No newline at end of file