YouTube API Scraper #225
This file contains hidden or 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
| # .github/workflows/scrape.yml | |
| name: YouTube API Scraper | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' # 06:00 UTC daily | |
| workflow_dispatch: | |
| jobs: | |
| scrape: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run API scraper | |
| env: | |
| YT_API_KEY: ${{ secrets.YT_API_KEY }} | |
| run: python api_scraper.py | |
| - name: Commit & push | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add video_data_final.json | |
| git diff --cached --quiet || git commit -m "Update scraped data [API]" | |
| git push |