Skip to content

FxTwitter extractor: username regex rejects usernames starting with digits #208

Description

@brettdavies

Bug

The FxTwitter extractor in src/extractors/x-oembed.ts silently fails for X/Twitter usernames that start with a digit. The regex in tryExtractFxTwitter:

const match = this.url.match(/\/([a-zA-Z][a-zA-Z0-9_]{0,14})\/(status|article)\/(\d+)/);

requires the first character to be [a-zA-Z], but X allows usernames starting with digits (e.g., 0xRicker, 0xMovez, 0xwhrrari). Since match returns null, tryExtractFxTwitter returns null, and the extractor silently falls back to oEmbed, which only returns the tweet text, not the article content.

The same pattern exists in src/extractors/x-article.ts in getAuthorFromUrl.

Reproduction

# Works: username starts with a letter (1627 words = full article)
bunx defuddle parse "https://x.com/coreyganim/status/2036070952987988290" --json | jq .wordCount
# 1627

# Fails: username starts with digit (4 words = just the tweet text, not the article)
bunx defuddle parse "https://x.com/0xRicker/status/2035334040216113631" --json | jq .wordCount
# 4

Both tweets are X Articles. FxTwitter API returns full content for both:

curl -s "https://api.fxtwitter.com/0xRicker/status/2035334040216113631" | jq '.tweet.article.title'
# "I Simulated 10,000 Polymarket Seasons. Only 3 Strategies Survived"

curl -s "https://api.fxtwitter.com/0xRicker/status/2035334040216113631" | jq '.tweet.article.content.blocks | length'
# 59

Suggested fix

Change [a-zA-Z][a-zA-Z0-9_]{0,14} to [a-zA-Z0-9_]{1,15} in the username capture group. Same pattern appears in two files:

- /\/([a-zA-Z][a-zA-Z0-9_]{0,14})\/(status|article)\/(\d+)/
+ /\/([a-zA-Z0-9_]{1,15})\/(status|article)\/(\d+)/

Also affects usernames starting with underscore (e.g. _akhaliq).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions