feat: add twitter article command for long-form Twitter Articles#15
Open
Catafal wants to merge 1 commit intojackwener:mainfrom
Open
feat: add twitter article command for long-form Twitter Articles#15Catafal wants to merge 1 commit intojackwener:mainfrom
Catafal wants to merge 1 commit intojackwener:mainfrom
Conversation
Adds `twitter article <id|url>` to read Twitter Articles (long-form posts) from the CLI. The article body is fetched via the TweetResultByRestId GraphQL endpoint and rendered as Markdown in the terminal using rich. Changes: - graphql.py: add TweetResultByRestId queryId to FALLBACK_QUERY_IDS - client.py: add fetch_article() using withArticlePlainText=True field toggle (required — omitting it silently drops the article body from the API response) - parser.py: _parse_article() converts draft.js content blocks to Markdown; parse_tweet_result() already calls it, populating Tweet.article_title/text - models.py + serialization.py: article_title/article_text fields already present and serialized/deserialized correctly - formatter.py: add print_article() — meta Panel (author, stats, link) + rich.Markdown body rendered below to avoid panel line-length constraints - cli.py: add `article` command with --json/--yaml/--compact support; extend _normalize_tweet_id() regex to accept /article/<id> URLs in addition to the existing /status/<id> pattern - README.md, SCHEMA.md, SKILL.md: document the new command, article-specific output fields, URL format, and agent workflow examples (EN + ZH) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
twitter article <id|url>command to fetch and display Twitter Articles (long-form posts, distinct from regular tweets)TweetResultByRestIdGraphQL endpoint (lighter thanTweetDetail— no replies timeline) with thewithArticlePlainText=Truefield toggle, which is required for the API to include the article body_parse_article()inparser.py, then rendered in the terminal usingrich.Markdown/article/<id>and/status/<id>patterns both supported)--json,--yaml, and--compactoutput modes consistently with all other read commandsarticleTitleandarticleTextfields are included in the standard tweet JSON/YAML output envelopeFiles changed
twitter_cli/graphql.pyTweetResultByRestIdqueryIdtwitter_cli/client.pyfetch_article()methodtwitter_cli/formatter.pyprint_article()with rich Panel + Markdown renderingtwitter_cli/cli.pyarticlecommand; extend URL regex to accept/article/pathsREADME.mdSCHEMA.mdarticleTitle/articleTextoutput fieldsSKILL.mdTest plan
twitter article <numeric-id>fetches and renders a known articletwitter article <full-article-url>(e.g.https://x.com/user/article/123) resolves correctlytwitter article <id> --jsonreturns envelope witharticleTitleandarticleTextunderdatatwitter article <regular-tweet-id>returns a clearnot_founderror (tweet has no article content)twitter article --helpshows correct usage🤖 Generated with Claude Code