Skip to content

Commit

Permalink
feat:urlsLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
Guovin committed Feb 27, 2024
1 parent 4d4ab70 commit 0e30300
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
- 接口效验,过滤无效接口,排序规则:日期、速度、分辨率
- 定时执行,每隔 12 小时执行更新一次
- 可设置重点关注频道,单独配置获取分页的数量
- 分页结果获取(可配置数量
- 分页结果获取(可配置页数、总接口数量

## 使用方法

1. Fork 此项目,开启 Action 工作流可读写权限
2. 修改 demo.txt 文件,后续更新根据此文件内容进行更新
3. 修改 main.py(可选):importantList(关注频道名称列表),importantPageNum(关注频道获取分页数量,默认值:10),defaultPageNum(常规频道获取分页数量,默认值:5),filter_invalid_url(是否过滤无效接口,默认开启)
3. 修改 main.py(可选):

- importantList:关注频道名称列表
- importantPageNum:关注频道获取分页数量,默认值:5
- defaultPageNum:常规频道获取分页数量,默认值:3
- urlsLimit:接口数量,默认值:15
- filter_invalid_url:是否过滤无效接口,默认开启

4. result.txt 为更新后的直播源文件,source.json 为数据源文件
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ class GetSource:
"湖南卫视",
"翡翠台",
]
importantPageNum = 10
defaultPageNum = 5
importantPageNum = 5
defaultPageNum = 3
urlsLimit = 15
filter_invalid_url = True

def __init__(self):
Expand Down Expand Up @@ -210,7 +211,7 @@ def extract_resolution(resolution_str):
reverse=True,
) # Sort by resolution
urls = list(dict.fromkeys(url for url, _, _ in infoList))
channelUrls[name] = urls
channelUrls[name] = (urls or channelObj[name])[: self.urlsLimit]
except Exception as e:
print(f"Error on sorting: {e}")
continue
Expand Down

0 comments on commit 0e30300

Please sign in to comment.