Skip to content

IPTV Daily Update

IPTV Daily Update #573

Workflow file for this run

name: IPTV Daily Update
on:
schedule:
- cron: '0 */4 * * *'
workflow_dispatch:
env:
TZ: Asia/Shanghai
jobs:
scrape-and-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: pip install aiohttp
- name: Run scraping script
run: python .github/workflows/iptv.py
- name: GetTime
run: echo "GET_TIME=$(date +'%Y-%m-%d %H:%M:%S CST')" >> $GITHUB_ENV
- name: Update README.md with run time and file link
run: |
file_link="https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/best_sorted.m3u" # 生成的文件是 best_sorted.m3u
file_link1="https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/best_sorted.m3u8" # 生成的文件是 best_sorted.m3u
sed -i "s|<!-- Last Run Time -->.*|<!-- Last Run Time --> ${GET_TIME}|" README.md
sed -i "s|<!-- Generated File Link M3U -->.*|<!-- Generated File Link M3U --> [View M3U File](${file_link})|" README.md
sed -i "s|<!-- Generated File Link M3U8 -->.*|<!-- Generated File Link M3U8 --> [View M3U8 File](${file_link1})|" README.md
- name: Commit changes
env:
REPO_URL: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git remote set-url origin $REPO_URL
git add README.md best_sorted.m3u best_sorted.m3u8
git commit -am "自动更新:${GET_TIME}"
git push origin main