Update list #212
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update list | |
on: | |
schedule: | |
- cron: '35 11 * * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -r requirements.txt | |
- name: Update list | |
run: python scrape.py | |
- name: Push update to Telegram and commit updated list to GitHub | |
env: | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
CHAT_ID: ${{ secrets.CHAT_ID }} | |
run: | | |
GIT_CHANGED=$(git status --porcelain) | |
if [[ $GIT_CHANGED ]]; then | |
RESULT=$(git diff -U0 list.csv | grep '^[+-]' | grep -Ev '^(--- a/|\+\+\+ b/)' | sed 's/^[+]//g' | perl -pe 's/^(\d+)-(\d+)-(\d+),(.+),(.+)$/aria2c -x16 -s16 -c -o \1\2\3.mp4 \5/g') | |
curl -s -S "https://api.telegram.org/$BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID" -d "text=\`\`\` | |
$RESULT | |
\`\`\`" -d 'parse_mode=MarkdownV2' > /dev/null | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m 'Update list' | |
git push -u origin main | |
fi |