trends.stumason.dev
TypeScript
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 formatscripts/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
- Merge
- Set env vars in Coolify:
TWITTER_USERNAME,TWITTER_EMAIL,TWITTER_PASSWORD - Install twikit on server:
pip3 install twikit - Run
php artisan migrate
Note
Needs a throwaway X account. Burner recommended — account may eventually get suspended.
+577
additions
-0
deletions
6
files changed