Skip to content

fix(twitter): resolve article ID to tweet ID for article URLs#691

Closed
jackwener wants to merge 1 commit intomainfrom
fix/twitter-article-resolve
Closed

fix(twitter): resolve article ID to tweet ID for article URLs#691
jackwener wants to merge 1 commit intomainfrom
fix/twitter-article-resolve

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Article URLs (x.com/i/article/{articleId}) use a different ID than tweet status URLs
  • The GraphQL TweetResultByRestId endpoint requires the parent tweet ID, not the article ID
  • Supersedes PR fix(twitter): resolve article ID to tweet ID before GraphQL query #688 — fixes the critical bug where all inputs (including status URLs) were routed through the article page

Fix

  • Detect article URLs upfront via regex before extracting the numeric ID
  • For article URLs: navigate to article page, extract parent tweet ID from DOM links (a[href*="/status/"]) or og:url meta tag
  • For status URLs or bare IDs: use directly as before (no behavior change)
  • Throw explicit error if article→tweet resolution fails (instead of silently falling through)

Test plan

  • opencli twitter article https://x.com/i/article/2038726133869625344 — should resolve to tweet ID and return article
  • opencli twitter article https://x.com/user/status/123456 — should work as before (no article resolution)
  • opencli twitter article 123456 — bare ID should work as before

Article URLs (x.com/i/article/{articleId}) use a different ID than
tweet status URLs. The GraphQL TweetResultByRestId endpoint requires
the parent tweet ID, not the article ID.

Fix: detect article URLs upfront, navigate to the article page to
extract the parent tweet ID from DOM links, then use the resolved
tweet ID for GraphQL. Status URLs continue to work as before.

Closes #688 (supersedes PR from gucasbrg — fixes the bug where all
inputs were routed through article page, breaking status URL flow).
@jackwener
Copy link
Copy Markdown
Owner Author

Fixed directly on PR #688's branch instead.

@jackwener jackwener closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant