From 18fe4b334db0fbfa21fe932b73a2e64ebdd456a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 13 Jan 2023 13:45:30 +0100 Subject: [PATCH] [twitter] remove 'tweet_search_mode' from search parameters (#3522) and update API root and general query parameters --- gallery_dl/extractor/twitter.py | 21 +++++++++++++++++---- gallery_dl/version.py | 4 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index c2d82478..5c8b36f5 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -945,7 +945,7 @@ class TwitterAPI(): def __init__(self, extractor): self.extractor = extractor - self.root = "https://twitter.com/i/api" + self.root = "https://api.twitter.com" self.headers = { "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejR" "COuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu" @@ -955,6 +955,7 @@ class TwitterAPI(): "x-twitter-client-language": "en", "x-twitter-active-user": "yes", "x-csrf-token": None, + "Origin": "https://twitter.com", "Referer": "https://twitter.com/", } self.params = { @@ -967,24 +968,36 @@ class TwitterAPI(): "include_can_dm": "1", "include_can_media_tag": "1", "include_ext_has_nft_avatar": "1", + "include_ext_is_blue_verified": "1", + "include_ext_verified_type": "1", "skip_status": "1", "cards_platform": "Web-12", "include_cards": "1", "include_ext_alt_text": "true", + "include_ext_limited_action_results": "false", "include_quote_count": "true", "include_reply_count": "1", "tweet_mode": "extended", + "include_ext_collab_control": "true", + "include_ext_views": "true", "include_entities": "true", "include_user_entities": "true", "include_ext_media_color": "true", "include_ext_media_availability": "true", "include_ext_sensitive_media_warning": "true", + "include_ext_trusted_friends_metadata": "true", "send_error_codes": "true", "simple_quoted_tweet": "true", + "q": None, "count": "100", + "query_source": None, "cursor": None, - "ext": "mediaStats,highlightedLabel,hasNftAvatar," - "voiceInfo,superFollowMetadata", + "pc": None, + "spelling_corrections": None, + "include_ext_edit_control": "true", + "ext": "mediaStats,highlightedLabel,hasNftAvatar,voiceInfo," + "enrichments,superFollowMetadata,unmentionInfo,editControl," + "collab_control,vibe", } self.variables = { "includePromotedContent": False, @@ -1095,7 +1108,7 @@ class TwitterAPI(): endpoint = "/2/search/adaptive.json" params = self.params.copy() params["q"] = query - params["tweet_search_mode"] = "live" + # params["tweet_search_mode"] = "live" params["query_source"] = "typed_query" params["pc"] = "1" params["spelling_corrections"] = "1" diff --git a/gallery_dl/version.py b/gallery_dl/version.py index aec56c9a..3df54c5b 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Copyright 2016-2022 Mike Fährmann +# Copyright 2016-2023 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.24.4" +__version__ = "1.24.5-dev"