update endpoints
This commit is contained in:
parent
a7d056a550
commit
116652c2a5
@ -12,9 +12,9 @@ proc getGraphUser*(username: string): Future[User] {.async.} =
|
|||||||
headers.add("Referer", """https://x.com/$1""" % username)
|
headers.add("Referer", """https://x.com/$1""" % username)
|
||||||
|
|
||||||
let
|
let
|
||||||
variables = """{"screen_name":"$1"}""" % username
|
variables = """{"screen_name":"$1","withGrokTranslatedBio":false}""" % username
|
||||||
fieldToggles = """{"withAuxiliaryUserLabels":true}"""
|
fieldToggles = """{"withPayments":false,"withAuxiliaryUserLabels":true}"""
|
||||||
params = {"variables": variables, "features": gqlFeatures, "fieldToggles": fieldToggles}
|
params = {"variables": variables, "features": userFeatures, "fieldToggles": fieldToggles}
|
||||||
js = await fetch(graphUser ? params, Api.userScreenName, headers)
|
js = await fetch(graphUser ? params, Api.userScreenName, headers)
|
||||||
result = parseGraphUser(js)
|
result = parseGraphUser(js)
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ proc getGraphUserById*(id: string): Future[User] {.async.} =
|
|||||||
|
|
||||||
let
|
let
|
||||||
variables = """{"userId":"$1"}""" % id
|
variables = """{"userId":"$1"}""" % id
|
||||||
params = {"variables": variables, "features": gqlFeatures}
|
params = {"variables": variables, "features": userFeatures}
|
||||||
js = await fetch(graphUserById ? params, Api.userRestId, headers)
|
js = await fetch(graphUserById ? params, Api.userRestId, headers)
|
||||||
result = parseGraphUser(js)
|
result = parseGraphUser(js)
|
||||||
|
|
||||||
|
|||||||
@ -34,16 +34,17 @@ proc genParams*(pars: openArray[(string, string)] = @[]; cursor="";
|
|||||||
proc genHeaders*(): HttpHeaders =
|
proc genHeaders*(): HttpHeaders =
|
||||||
let
|
let
|
||||||
t = getTime()
|
t = getTime()
|
||||||
ffVersion = floor(124 + ((t.toUnix() / 1000) - 1710892800) / 2419200)
|
ffVersion = floor(124 + (t.toUnix() - 1710892800) / 2419200)
|
||||||
result = newHttpHeaders({
|
result = newHttpHeaders({
|
||||||
"connection": "keep-alive",
|
"Connection": "keep-alive",
|
||||||
"authorization": auth,
|
"Authorization": auth,
|
||||||
"content-type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"accept-encoding": "gzip",
|
"Accept-Encoding": "gzip",
|
||||||
"accept-language": "en-US,en;q=0.5",
|
"Accept-Language": "en-US,en;q=0.5",
|
||||||
"accept": "*/*",
|
"Accept": "*/*",
|
||||||
"DNT": "1",
|
"DNT": "1",
|
||||||
"Host": "x.com",
|
"Host": "x.com",
|
||||||
|
"Origin": "https://x.com/",
|
||||||
"Sec-Fetch-Dest": "empty",
|
"Sec-Fetch-Dest": "empty",
|
||||||
"Sec-Fetch-Mode": "cors",
|
"Sec-Fetch-Mode": "cors",
|
||||||
"Sec-Fetch-Site": "same-origin",
|
"Sec-Fetch-Site": "same-origin",
|
||||||
|
|||||||
@ -15,23 +15,23 @@ const
|
|||||||
timelineApi = api / "2/timeline"
|
timelineApi = api / "2/timeline"
|
||||||
|
|
||||||
graphql = api / "graphql"
|
graphql = api / "graphql"
|
||||||
graphUser* = graphql / "ZHSN3WlvahPKVvUxVQbg1A/UserByScreenName"
|
graphUser* = graphql / "-oaLodhGbbnzJBACb1kk2Q/UserByScreenName"
|
||||||
graphUserById* = graphql / "XIpMDIi_YoVzXeoON-cfAQ/UserByRestId"
|
graphUserById* = graphql / "Bbaot8ySMtJD7K2t01gW7A/UserByRestId"
|
||||||
graphUserTweets* = graphql / "oRJs8SLCRNRbQzuZG93_oA/UserTweets"
|
graphUserTweets* = graphql / "lZRf8IC-GTuGxDwcsHW8aw/UserTweets"
|
||||||
graphUserTweetsAndReplies* = graphql / "kkaJ0Mf34PZVarrxzLihjg/UserTweetsAndReplies"
|
graphUserTweetsAndReplies* = graphql / "gXCeOBFsTOuimuCl1qXimg/UserTweetsAndReplies"
|
||||||
graphUserMedia* = graphql / "36oKqyQ7E_9CmtONGjJRsA/UserMedia"
|
graphUserMedia* = graphql / "1D04dx9H2pseMQAbMjXTvQ/UserMedia"
|
||||||
graphTweet* = graphql / "YVyS4SfwYW7Uw5qwy0mQCA/TweetDetail"
|
graphTweet* = graphql / "6QzqakNMdh_YzBAR9SYPkQ/TweetDetail"
|
||||||
graphTweetResult* = graphql / "tCVRZ3WCvoj0BVO7BKnL-Q/TweetResultByRestId"
|
graphTweetResult* = graphql / "kLXoXTloWpv9d2FSXRg-Tg/TweetResultByRestId"
|
||||||
graphTweetHistory* = graphql / "WT7HhrzWulh4yudKJaR10Q/TweetEditHistory"
|
graphTweetHistory* = graphql / "WT7HhrzWulh4yudKJaR10Q/TweetEditHistory"
|
||||||
graphSearchTimeline* = graphql / "7r8ibjHuK3MWUyzkzHNMYQ/SearchTimeline"
|
graphSearchTimeline* = graphql / "bshMIjqDk8LTXTq4w91WKw/SearchTimeline"
|
||||||
graphListById* = graphql / "iTpgCtbdxrsJfyx0cFjHqg/ListByRestId"
|
graphListById* = graphql / "iTpgCtbdxrsJfyx0cFjHqg/ListByRestId"
|
||||||
graphListBySlug* = graphql / "-kmqNvm5Y-cVrfvBy6docg/ListBySlug"
|
graphListBySlug* = graphql / "-kmqNvm5Y-cVrfvBy6docg/ListBySlug"
|
||||||
graphListMembers* = graphql / "P4NpVZDqUD_7MEM84L-8nw/ListMembers"
|
graphListMembers* = graphql / "P4NpVZDqUD_7MEM84L-8nw/ListMembers"
|
||||||
graphListTweets* = graphql / "BbGLL1ZfMibdFNWlk7a0Pw/ListTimeline"
|
graphListTweets* = graphql / "BbGLL1ZfMibdFNWlk7a0Pw/ListTimeline"
|
||||||
graphFavoriters* = graphql / "mDc_nU8xGv0cLRWtTaIEug/Favoriters"
|
graphFavoriters* = graphql / "mDc_nU8xGv0cLRWtTaIEug/Favoriters"
|
||||||
graphRetweeters* = graphql / "RCR9gqwYD1NEgi9FWzA50A/Retweeters"
|
graphRetweeters* = graphql / "RCR9gqwYD1NEgi9FWzA50A/Retweeters"
|
||||||
graphFollowers* = graphql / "Efm7xwLreAw77q2Fq7rX-Q/Followers"
|
graphFollowers* = graphql / "SCu9fVIlCUm-BM8-tL5pkQ/Followers"
|
||||||
graphFollowing* = graphql / "e0UtTAwQqgLKBllQxMgVxQ/Following"
|
graphFollowing* = graphql / "S5xUN9s2v4xk50KWGGvyvQ/Following"
|
||||||
favorites* = graphql / "eSSNbhECHHWWALkkQq-YTA/Likes"
|
favorites* = graphql / "eSSNbhECHHWWALkkQq-YTA/Likes"
|
||||||
|
|
||||||
timelineParams* = {
|
timelineParams* = {
|
||||||
@ -51,7 +51,14 @@ const
|
|||||||
}.toSeq
|
}.toSeq
|
||||||
|
|
||||||
gqlFeatures* = """{
|
gqlFeatures* = """{
|
||||||
|
"rweb_video_screen_enabled": false,
|
||||||
|
"profile_label_improvements_pcf_label_in_post_enabled": true,
|
||||||
|
"responsive_web_profile_redirect_enabled": false,
|
||||||
|
"rweb_tipjar_consumption_enabled": true,
|
||||||
|
"verified_phone_label_enabled": false,
|
||||||
"creator_subscriptions_tweet_preview_api_enabled": true,
|
"creator_subscriptions_tweet_preview_api_enabled": true,
|
||||||
|
"responsive_web_graphql_timeline_navigation_enabled": true,
|
||||||
|
"responsive_web_graphql_skip_user_profile_image_extensions_enabled": false,
|
||||||
"premium_content_api_read_enabled": false,
|
"premium_content_api_read_enabled": false,
|
||||||
"communities_web_enable_tweet_community_results_fetch": true,
|
"communities_web_enable_tweet_community_results_fetch": true,
|
||||||
"c9s_tweet_anatomy_moderator_badge_enabled": true,
|
"c9s_tweet_anatomy_moderator_badge_enabled": true,
|
||||||
@ -74,26 +81,26 @@ const
|
|||||||
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true,
|
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true,
|
||||||
"longform_notetweets_rich_text_read_enabled": true,
|
"longform_notetweets_rich_text_read_enabled": true,
|
||||||
"longform_notetweets_inline_media_enabled": true,
|
"longform_notetweets_inline_media_enabled": true,
|
||||||
"payments_enabled": false,
|
"responsive_web_grok_image_annotation_enabled": true,
|
||||||
|
"responsive_web_grok_imagine_annotation_enabled": true,
|
||||||
|
"responsive_web_grok_community_note_auto_translation_is_enabled": false,
|
||||||
|
"responsive_web_enhance_cards_enabled": false
|
||||||
|
}""".replace(" ", "").replace("\n", "")
|
||||||
|
|
||||||
|
userFeatures* = """{
|
||||||
|
"hidden_profile_subscriptions_enabled": true,
|
||||||
"profile_label_improvements_pcf_label_in_post_enabled": true,
|
"profile_label_improvements_pcf_label_in_post_enabled": true,
|
||||||
"responsive_web_profile_redirect_enabled": false,
|
"responsive_web_profile_redirect_enabled": false,
|
||||||
"rweb_tipjar_consumption_enabled": true,
|
"rweb_tipjar_consumption_enabled": true,
|
||||||
"verified_phone_label_enabled": false,
|
"verified_phone_label_enabled": false,
|
||||||
"responsive_web_grok_image_annotation_enabled": true,
|
"subscriptions_verification_info_is_identity_verified_enabled": true,
|
||||||
"responsive_web_grok_imagine_annotation_enabled": true,
|
|
||||||
"responsive_web_grok_community_note_auto_translation_is_enabled": false,
|
|
||||||
"responsive_web_graphql_skip_user_profile_image_extensions_enabled": false,
|
|
||||||
"responsive_web_graphql_timeline_navigation_enabled": true,
|
|
||||||
"responsive_web_enhance_cards_enabled": false,
|
|
||||||
"rweb_client_transaction_id_enabled": false,
|
|
||||||
"rweb_xp_forwarded_for_enabled": false,
|
|
||||||
"subscriptions_verification_info_verified_since_enabled": true,
|
"subscriptions_verification_info_verified_since_enabled": true,
|
||||||
"highlights_tweets_tab_ui_enabled": true,
|
"highlights_tweets_tab_ui_enabled": true,
|
||||||
"hidden_profile_subscriptions_enabled": true,
|
|
||||||
"subscriptions_verification_info_is_identity_verified_enabled": true,
|
|
||||||
"subscriptions_feature_can_gift_premium": false,
|
|
||||||
"responsive_web_twitter_article_notes_tab_enabled": true,
|
"responsive_web_twitter_article_notes_tab_enabled": true,
|
||||||
"rweb_video_screen_enabled": true
|
"subscriptions_feature_can_gift_premium": true,
|
||||||
|
"creator_subscriptions_tweet_preview_api_enabled": true,
|
||||||
|
"responsive_web_graphql_skip_user_profile_image_extensions_enabled": false,
|
||||||
|
"responsive_web_graphql_timeline_navigation_enabled": true
|
||||||
}""".replace(" ", "").replace("\n", "")
|
}""".replace(" ", "").replace("\n", "")
|
||||||
|
|
||||||
tweetVariables* = """{
|
tweetVariables* = """{
|
||||||
@ -141,7 +148,8 @@ const
|
|||||||
"userId": "$1",
|
"userId": "$1",
|
||||||
$2
|
$2
|
||||||
"count": 20,
|
"count": 20,
|
||||||
"includePromotedContent": false
|
"includePromotedContent": false,
|
||||||
|
"withGrokTranslatedBio": false
|
||||||
}""".replace(" ", "").replace("\n", "")
|
}""".replace(" ", "").replace("\n", "")
|
||||||
|
|
||||||
userMediaVariables* = """{
|
userMediaVariables* = """{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user