Skip to content

Commit

Permalink
[twitter] update query hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Apr 3, 2023
1 parent 3846ce0 commit 3cc1dd1
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions gallery_dl/extractor/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ class TwitterListMembersExtractor(TwitterExtractor):
"""Extractor for members of a Twitter list"""
subcategory = "list-members"
pattern = BASE_PATTERN + r"/i/lists/(\d+)/members"
test = ("https://twitter.com/i/lists/784214683683127296/members",)
test = ("https://twitter.com/i/lists/784214683683127296/members", {
"pattern": TwitterTimelineExtractor.pattern,
"range": "1-40",
"count": 40,
})

def items(self):
self.login()
Expand Down Expand Up @@ -1008,9 +1012,6 @@ def __init__(self, extractor):

auth_token = cookies.get("auth_token", domain=cookiedomain)

if not auth_token:
self.user_media = self.user_media_legacy

self.headers = {
"Accept": "*/*",
"authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejR"
Expand Down Expand Up @@ -1071,6 +1072,7 @@ def __init__(self, extractor):
"withReactionsPerspective": False,
}
self.features = {
"blue_business_profile_image_shape_enabled": False,
"responsive_web_twitter_blue_verified_badge_is_enabled": True,
"responsive_web_graphql_exclude_directive_enabled": True,
"verified_phone_label_enabled": False,
Expand Down Expand Up @@ -1104,7 +1106,7 @@ def __init__(self, extractor):
}

def tweet_detail(self, tweet_id):
endpoint = "/graphql/zXaXQgfyR4GxE21uwYQSyA/TweetDetail"
endpoint = "/graphql/AV_lPTkN6Fc6LgerQpK8Zg/TweetDetail"
variables = {
"focalTweetId": tweet_id,
"referrer": "profile",
Expand All @@ -1122,7 +1124,7 @@ def tweet_detail(self, tweet_id):
endpoint, variables, ("threaded_conversation_with_injections_v2",))

def user_tweets(self, screen_name):
endpoint = "/graphql/9rys0A7w1EyqVd2ME0QCJg/UserTweets"
endpoint = "/graphql/BeHK76TOCY3P8nO-FWocjA/UserTweets"
variables = {
"userId": self._user_id_by_screen_name(screen_name),
"count": 100,
Expand All @@ -1134,7 +1136,7 @@ def user_tweets(self, screen_name):
return self._pagination_tweets(endpoint, variables)

def user_tweets_and_replies(self, screen_name):
endpoint = "/graphql/ehMCHF3Mkgjsfz_aImqOsg/UserTweetsAndReplies"
endpoint = "/graphql/eZVlZu_1gwb6hMUDXBnZoQ/UserTweetsAndReplies"
variables = {
"userId": self._user_id_by_screen_name(screen_name),
"count": 100,
Expand All @@ -1146,7 +1148,7 @@ def user_tweets_and_replies(self, screen_name):
return self._pagination_tweets(endpoint, variables)

def user_media(self, screen_name):
endpoint = "/graphql/MA_EP2a21zpzNWKRkaPBMg/UserMedia"
endpoint = "/graphql/d_ONZLUHGCsErBCriRsLXg/UserMedia"
variables = {
"userId": self._user_id_by_screen_name(screen_name),
"count": 100,
Expand Down Expand Up @@ -1179,7 +1181,7 @@ def user_media_legacy(self, screen_name):
features=False)

def user_likes(self, screen_name):
endpoint = "/graphql/XbHBYpgURwtklXj8NNxTDw/Likes"
endpoint = "/graphql/fN4-E0MjFJ9Cn7IYConL7g/Likes"
variables = {
"userId": self._user_id_by_screen_name(screen_name),
"count": 100,
Expand All @@ -1203,7 +1205,7 @@ def user_bookmarks(self):
features=features)

def list_latest_tweets_timeline(self, list_id):
endpoint = "/graphql/FDI9EiIp54KxEOWGiv3B4A/ListLatestTweetsTimeline"
endpoint = "/graphql/5DAiJG3bD77SiWEs4xViBw/ListLatestTweetsTimeline"
variables = {
"listId": list_id,
"count": 100,
Expand Down Expand Up @@ -1238,7 +1240,7 @@ def live_event(self, event_id):
["twitter_objects"]["live_events"][event_id])

def list_by_rest_id(self, list_id):
endpoint = "/graphql/KlGpwq5CAt9tCfHkV2mwYQ/ListByRestId"
endpoint = "/graphql/D0EoyrDcct2MEqC-LnPzFg/ListByRestId"
params = {
"variables": self._json_dumps({
"listId": list_id,
Expand All @@ -1252,7 +1254,7 @@ def list_by_rest_id(self, list_id):
raise exception.NotFoundError("list")

def list_members(self, list_id):
endpoint = "/graphql/XsAJX17RLgLYU8GALIWg2g/ListMembers"
endpoint = "/graphql/tzsIIbGUH9RyFCVmtO2W2w/ListMembers"
variables = {
"listId": list_id,
"count": 100,
Expand All @@ -1262,7 +1264,7 @@ def list_members(self, list_id):
endpoint, variables, ("list", "members_timeline", "timeline"))

def user_following(self, screen_name):
endpoint = "/graphql/vTZwBbd_gz6aI8v6Wze21A/Following"
endpoint = "/graphql/FaBzCqZXuQCb4PhB0RHqHw/Following"
variables = {
"userId": self._user_id_by_screen_name(screen_name),
"count": 100,
Expand All @@ -1271,7 +1273,7 @@ def user_following(self, screen_name):
return self._pagination_users(endpoint, variables)

def user_by_rest_id(self, rest_id):
endpoint = "/graphql/QPSxc9lxrmrwnBzYkJI8eA/UserByRestId"
endpoint = "/graphql/S2BkcAyFMG--jef2N6Dgzw/UserByRestId"
params = {
"variables": self._json_dumps({
"userId": rest_id,
Expand All @@ -1282,7 +1284,7 @@ def user_by_rest_id(self, rest_id):
return self._call(endpoint, params)["data"]["user"]["result"]

def user_by_screen_name(self, screen_name):
endpoint = "/graphql/nZjSkpOpSL5rWyIVdsKeLA/UserByScreenName"
endpoint = "/graphql/k26ASEiniqy4eXMdknTSoQ/UserByScreenName"
params = {
"variables": self._json_dumps({
"screen_name": screen_name,
Expand Down

0 comments on commit 3cc1dd1

Please sign in to comment.