fix(twitter): use dynamic features for profile command - #2274
Open
BernardGeorge wants to merge 1 commit into
Open
fix(twitter): use dynamic features for profile command#2274BernardGeorge wants to merge 1 commit into
BernardGeorge wants to merge 1 commit into
Conversation
The profile command hardcoded 13 feature flags that became outdated. When these flags don't match what Twitter expects, the UserByScreenName GraphQL API returns a truncated response missing relationship_counts, legacy, profile_bio, tweet_counts, and action_counts — causing followers/following/tweets/likes to return 0 and bio to return empty. Fix: use resolveTwitterOperationMetadata() (already available in shared.js) to get both queryId AND the correct dynamic features from fa0311/twitter-openapi, instead of only using resolveTwitterQueryId() which discards the features. Verified: opencli twitter profile @ElonMusk now returns followers=241243979, bio='https://t.co/ZdBx5WABYx', tweets=106924 instead of all zeros/empty.
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
Fixes #2273
opencli twitter profilereturns0forfollowers/following/tweets/likesand empty forbiobecause it uses hardcodedfeaturesflags that Twitter no longer accepts.Problem
clis/twitter/profile.jshardcodes 13 feature flags for theUserByScreenNameGraphQL API. When these flags are outdated, Twitter returns a truncated response missingrelationship_counts,legacy,profile_bio,tweet_counts, andaction_counts— so all numeric fields default to0andbioto empty string.Meanwhile,
shared.jsalready providesresolveTwitterOperationMetadata()which returns both the correctqueryIdAND the currentfeatures(fetched fromfa0311/twitter-openapi). Butprofile.jsonly callsresolveTwitterQueryId()which discards the features.Fix
3 changes in
clis/twitter/profile.js:resolveTwitterOperationMetadatafromshared.jsresolveTwitterQueryId()withresolveTwitterOperationMetadata()to get bothqueryIdandfeaturesfeaturesblock with the dynamically-resolved features, injected intopage.evaluatevia template literalVerification
Before (hardcoded features):
{"screen_name": "elonmusk", "name": "Elon Musk", "bio": "", "followers": 0, "tweets": 0, "likes": 0}After (dynamic features):
{"screen_name": "elonmusk", "name": "Elon Musk", "bio": "https://t.co/ZdBx5WABYx", "followers": 241243979, "following": 1386, "tweets": 106924, "likes": 243349}Tested with
OPENCLI_HEADFUL=1 OPENCLI_KEEP_TAB=true opencli twitter profile @elonmusk --format json.