How dylanpdx/bettertwitfix works
vxTwitter is a Flask service that turns Twitter/X post links into Discord-friendly embeds and exposes tweet data through an API. The main workflow accepts a post URL, obtains and formats tweet data, then serves an embed or API response. Documented supporting capabilities include configurable caching, image combination, GIF conversion, browser redirection preferences, oEmbed/activity responses, and translation. The excerpts show the Flask entry point and several helpers; some internal call wiring and unsampled route details are omitted, so those links are not inferred.
Main entry points: twitfix.py Flask routes · __init__.py Tweet extraction · cache.py Link cache · openInApp.js Redirect preferences
Components 20
Request handling
- Flask routes
twitfix.py - Configuration
configHandler.py - Redirect preferences
static/openInApp.js
Tweet data
- Tweet extraction
twExtract/__init__.py - Tweet normalization
vxApi.py - Tweet utilities
utils.py - Link cache
cache.py
Embed and presentation
- Embed templates
templates - Activity output
activity.py - oEmbed output
twitfix.py
Optional services
- Image combination
combineImg/__init__.py - GIF conversion
gifConvert/__init__.py - Translation
translation.py
Other components
- Link visitor
- API client
- Discord
- Twitter/X
- MongoDB
- DynamoDB
- Twitter media
Connections 22
- Link visitor → Flask routes: requests post link
- API client → Flask routes: requests tweet data
- Discord → Flask routes: requests embed
- Flask routes → Configuration: reads settings
- Flask routes → Link cache: checks cached link
- Flask routes → Tweet extraction: fetches tweet
- Tweet extraction → Twitter/X: requests tweet data
- Tweet extraction → Tweet normalization: provides tweet response
- Flask routes → Tweet normalization: formats API data
- Flask routes → Tweet utilities: uses tweet helpers
- Flask routes → Embed templates: renders page
- Flask routes → Activity output: generates activity
- Flask routes → oEmbed output: serves oEmbed
- Flask routes → Image combination: combines images
- Image combination → Twitter media: downloads images
- Flask routes → GIF conversion: uses GIF conversion
- GIF conversion → Twitter media: downloads video
- Flask routes → Translation: requests translation
- Link cache → MongoDB: reads and writes
- Link cache → DynamoDB: reads and writes
- Link visitor → Redirect preferences: sets redirect choice
- Redirect preferences → Link visitor: opens app or frontend