Skip to content

Commit

Permalink
Merge pull request #64 from Guovin/dev
Browse files Browse the repository at this point in the history
Release v1.0.4
  • Loading branch information
Guovin authored Apr 8, 2024
2 parents 4a39c35 + 6f62c34 commit 07a4377
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- 更新 Github 使用条款,请务必仔细阅读并遵守(Updated GitHub Terms of Service, please read and comply carefully)
- 更新使用说明,关于可能导致工作流资源滥用的情况说明(Updated usage instructions, explanation about situations that may lead to workflow resource abuse)
- 增加.gitignore 文件,忽略用户配置、接口更新结果、日志文件等上传,非代码逻辑修改请不要发起 Pull requests,避免影响他人使用(Added .gitignore file to ignore uploads of user configurations, interface update results, log files, etc. Please do not initiate pull requests for non-code logic modifications to avoid affecting others' use)
- 调整更新频率,每日 8:00 执行一次(Adjusted update frequency, executes once daily at 8:00)
- 调整更新频率,北京时间每日 8:00 执行一次(Adjusted update frequency, executes once daily at 8:00 am Beijing time)
- 调整更新频道数量上限(200 个)(Adjusted the maximum limit for updating channel numbers (200))

## v1.0.3

Expand Down
4 changes: 3 additions & 1 deletion README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ Customize channel menus, automatically fetch and update the latest live source i
- Customize templates to generate the channel categories and order you want
- Interface validation to filter out invalid interfaces
- Comprehensive sorting based on response time and resolution
- Scheduled execution, updates every 12 hours
- Scheduled execution, updates every day at 8:00 am Beijing time
- The maximum number of update channels is 200
- Set up key focus channels and configure the number of pages fetched separately
- Pagination results retrieval (configurable number of pages and interfaces)
- Ensure update timeliness, configure to retrieve interfaces updated within a recent time range
- Can filter ipv4, ipv6 interfaces
- Blacklist feature: Interface domain and keywords

## Config

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
- 自定义模板,生成您想要的频道分类与频道顺序
- 接口验效,过滤无效接口
- 按响应时间、分辨率综合权衡排序
- 定时执行,每隔 12 小时执行更新一次
- 定时执行,北京时间每日 8:00 执行更新一次
- 更新频道数量上限 200 个
- 可设置重点关注频道,单独配置获取分页的数量
- 分页结果获取(可配置页数、接口数量)
- 保证更新时效性,配置获取最近时间范围内更新的接口
- 可过滤 ipv4、ipv6 接口
- 黑名单功能:接口域名与关键字

## 配置

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ When you click to confirm and create in step one, you will be automatically redi

1. Create file
2. Name the template file user_demo.txt
3. The template file needs to be written in the format of (channel category, #genre#), (channel name, channel interface), note that it is an English comma.
3. The template file needs to be written in the format of (channel category, #genre#), (channel name, channel interface), note that it is an English comma. The maximum number of channels is 200, any excess will not be updated.
4. Click Commit changes... to save.

## Step 3: Modify the Configuration
Expand Down Expand Up @@ -125,12 +125,12 @@ https://mirror.ghproxy.com/raw.githubusercontent.com/your github username/reposi

If you can access this link and it returns the updated interface content, then your live source interface link has been successfully created! Simply copy and paste this link into software like TVBox in the configuration field to use~

- Note: Except for the first execution of the workflow, which requires you to manually trigger it, subsequent executions (default: daily at 8:00) will be automatically triggered. If you have modified the template or configuration files and want to execute the update immediately, you can manually trigger (2) Run workflow.
- Note: Except for the first execution of the workflow, which requires you to manually trigger it, subsequent executions (default: daily at 8:00 am Beijing time) will be automatically triggered. If you have modified the template or configuration files and want to execute the update immediately, you can manually trigger (2) Run workflow.

## Step 5: Modify Workflow Update Frequency

![.github/workflows/main.yml](./images/schedule-cron.png '.github/workflows/main.yml')
If you want to modify the update frequency (default: daily at 8:00), you can modify the on:schedule:- cron field.
If you want to modify the update frequency (default: daily at 8:00 am Beijing time), you can modify the on:schedule:- cron field.

- #### It is strongly discouraged to make modifications, as there is no difference in the content of the interface in a short period of time. Both too frequent updates and high-consumption running workflows may be judged as resource abuse, leading to the risk of the repository and account being banned.
- #### Please pay attention to the runtime of your workflow. If you find that the execution time is too long, you need to appropriately reduce the number of channels in the template, modify the number of pages and interfaces in the configuration, in order to meet the compliant operation requirements.
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

1. 创建文件
2. 模板文件命名为 user_demo.txt
3. 模板文件需要按照(频道分类,#genre#),(频道名称,频道接口)进行编写,注意是英文逗号
3. 模板文件需要按照(频道分类,#genre#),(频道名称,频道接口)进行编写,注意是英文逗号。频道总数上限为 200 个,超出部分将无法更新。
4. 点击 Commit changes...进行保存

## 步骤三:修改配置
Expand Down Expand Up @@ -124,12 +124,12 @@ https://mirror.ghproxy.com/raw.githubusercontent.com/您的github用户名/仓

如果访问该链接能正常返回更新后的接口内容,说明您的直播源接口链接已经大功告成了!将该链接复制粘贴到 TVBox 等软件配置栏中即可使用~

- 注意:除了首次执行工作流需要您手动触发,后续执行(默认每日 8:00)将自动触发。如果您修改了模板或配置文件想立刻执行更新,可手动触发(2)中的 Run workflow 即可。
- 注意:除了首次执行工作流需要您手动触发,后续执行(默认北京时间每日 8:00)将自动触发。如果您修改了模板或配置文件想立刻执行更新,可手动触发(2)中的 Run workflow 即可。

## 步骤五:修改工作流更新频率

![.github/workflows/main.yml](./images/schedule-cron.png '.github/workflows/main.yml')
如果您想修改更新频率(默认每日 8:00),可修改 on:schedule:- cron 字段。
如果您想修改更新频率(默认北京时间每日 8:00),可修改 on:schedule:- cron 字段。

- #### 强烈不建议修改,因为短时间内的接口内容并无差异,过高的更新频率与高耗时运行的工作流都有可能被判定为资源滥用,导致仓库与账户被封禁的风险。
- #### 请留意您的工作流运行时长,若发现执行时间过长,需要适当删减模板中频道数量、修改配置中的分页数量和接口数量,以达到合规的运行要求。
Expand Down
19 changes: 11 additions & 8 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import ipaddress
from urllib.parse import urlparse

# 在这里使用 some_config_variable


def getChannelItems():
"""
Expand All @@ -30,23 +28,28 @@ def getChannelItems():

# Create a dictionary to store the channels.
channels = {}
current_channel = ""
current_category = ""
pattern = r"^(.*?),(?!#genre#)(.*?)$"
total_channels = 0
max_channels = 200

for line in lines:
if total_channels >= max_channels:
break
line = line.strip()
if "#genre#" in line:
# This is a new channel, create a new key in the dictionary.
current_channel = line.split(",")[0]
channels[current_channel] = {}
current_category = line.split(",")[0]
channels[current_category] = {}
else:
# This is a url, add it to the list of urls for the current channel.
match = re.search(pattern, line)
if match:
if match.group(1) not in channels[current_channel]:
channels[current_channel][match.group(1)] = [match.group(2)]
if match.group(1) not in channels[current_category]:
channels[current_category][match.group(1)] = [match.group(2)]
total_channels += 1
else:
channels[current_channel][match.group(1)].append(match.group(2))
channels[current_category][match.group(1)].append(match.group(2))
return channels


Expand Down

0 comments on commit 07a4377

Please sign in to comment.