Stu Mason
Stu Mason

Activity

Pull Request Merged

PR #68 merged: Add Twitter/X fetcher via Twikit

What

Twitter/X data source for DevTrends using Twikit — a Python library that uses Twitter's internal API (no API key needed, just a throwaway account).

How it works

  • PHP fetcher (TwitterFetcher.php) shells out to a Python script via Laravel's Process facade
  • Python script (scripts/twitter_fetcher.py) handles auth, cookie caching, search, and outputs JSON to stdout
  • Two-language bridge because Twikit is Python-only and the best free option for X scraping

What's in the PR

  • app/Services/Fetchers/TwitterFetcher.php — extends BaseFetcher, normalizes tweets to standard format
  • scripts/twitter_fetcher.py — async Twikit search with cookie caching at /tmp/twikit_cookies.json
  • Migration: 10 search sources (AI coding, Laravel, React, Rust, DevOps, etc) on standard tier
  • config/services.php — twitter username/email/password + youtube api_key entries
  • FetchFirehoseCommand updated with twitter fetcher mapping
  • 7 Pest tests, all passing (37 assertions)

To go live

  1. Merge
  2. Set env vars in Coolify: TWITTER_USERNAME, TWITTER_EMAIL, TWITTER_PASSWORD
  3. Install twikit on server: pip3 install twikit
  4. Run php artisan migrate

Note

Needs a throwaway X account. Burner recommended — account may eventually get suspended.

+577
additions
-0
deletions
6
files changed