Skip to content

Instantly share code, notes, and snippets.

@letanure
Created February 28, 2024 00:25
Show Gist options
  • Save letanure/80d4b51585b5979f0080ae0114058e38 to your computer and use it in GitHub Desktop.
Save letanure/80d4b51585b5979f0080ae0114058e38 to your computer and use it in GitHub Desktop.
fetch twitter response and eval
fetch("https://twitter.com/i/api/graphql/q2SYrdJX7r5Lf0e6sHuM9g/TweetDetail?variables=%7B%22focalTweetId%22%3A%221762536011752485276%22%2C%22with_rux_injections%22%3Afalse%2C%22includePromotedContent%22%3Atrue%2C%22withCommunity%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withBirdwatchNotes%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22c9s_tweet_anatomy_moderator_badge_enabled%22%3Atrue%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22rweb_video_timestamps_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D&fieldToggles=%7B%22withArticleRichContentState%22%3Atrue%7D", {
"headers": {
"accept": "*/*",
"accept-language": "en,pt-BR;q=0.9,pt;q=0.8,de;q=0.7,en-US;q=0.6,la;q=0.5",
"authorization": `${proccess.env.twiter-token}`,
"content-type": "application/json",
"sec-ch-ua": "\"Not A(Brand\";v=\"99\", \"Google Chrome\";v=\"121\", \"Chromium\";v=\"121\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-client-transaction-id": "gmmFsXd5IvL/UPf8dMO6OfeniO+3tZxRxbzmgBOm3IS6ZoaNo1Vl4tlDqCnLsHJW6vYUZeXDYNBlv4yaJFl7fNCp+XA/43J5gw",
"x-csrf-token": "0c1cd9bf31d83ab5c6f6d5019bba3fa21d8bb6a1d288fbd00132fc1ea2fc717f54b5e16f8eeeddfeb0ccb75fabfdb7ba15708d40d24452fbf0b04a191fccaf1922723db425a05f52caae0cda7b354c1a6624c",
"x-twitter-active-user": "yes",
"x-twitter-auth-type": "OAuth2Session",
"x-twitter-client-language": "en"
},
"referrer": "https://twitter.com/felipperegazio/status/1762536011752485276?s=46&t=sOV5n9kearz4Ng8meT3QVw",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
})
.then(response => response.json())
.then(data => {
eval( data.data.threaded_conversation_with_injections_v2.instructions[0].entries[1].content.itemContent.tweet_results.result.legacy.full_text);
})
.catch(error => {
console.error('Error:', error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment