mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
[extractor/twitter] Fix graphql extraction on some tweets (#6075)
Authored by: selfisekai
This commit is contained in:
parent
acacb57c7e
commit
7543c9c99b
1 changed files with 27 additions and 1 deletions
|
@ -769,6 +769,29 @@ class TwitterIE(TwitterBaseIE):
|
||||||
'age_limit': 0,
|
'age_limit': 0,
|
||||||
},
|
},
|
||||||
'params': {'noplaylist': True},
|
'params': {'noplaylist': True},
|
||||||
|
}, {
|
||||||
|
# id pointing to TweetWithVisibilityResults type entity which wraps the actual Tweet over
|
||||||
|
# note the id different between extraction and url
|
||||||
|
'url': 'https://twitter.com/s2FAKER/status/1621117700482416640',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1621117577354424321',
|
||||||
|
'display_id': '1621117700482416640',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '뽀 - 아 최우제 이동속도 봐',
|
||||||
|
'description': '아 최우제 이동속도 봐 https://t.co/dxu2U5vXXB',
|
||||||
|
'duration': 24.598,
|
||||||
|
'uploader': '뽀',
|
||||||
|
'uploader_id': 's2FAKER',
|
||||||
|
'uploader_url': 'https://twitter.com/s2FAKER',
|
||||||
|
'upload_date': '20230202',
|
||||||
|
'timestamp': 1675339553.0,
|
||||||
|
'thumbnail': r're:https?://pbs\.twimg\.com/.+',
|
||||||
|
'age_limit': 18,
|
||||||
|
'tags': [],
|
||||||
|
'like_count': int,
|
||||||
|
'repost_count': int,
|
||||||
|
'comment_count': int,
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
# onion route
|
# onion route
|
||||||
'url': 'https://twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion/TwitterBlue/status/1484226494708662273',
|
'url': 'https://twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion/TwitterBlue/status/1484226494708662273',
|
||||||
|
@ -811,9 +834,12 @@ def _graphql_to_legacy(self, data, twid):
|
||||||
result = traverse_obj(data, (
|
result = traverse_obj(data, (
|
||||||
'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries',
|
'threaded_conversation_with_injections_v2', 'instructions', 0, 'entries',
|
||||||
lambda _, v: v['entryId'] == f'tweet-{twid}', 'content', 'itemContent',
|
lambda _, v: v['entryId'] == f'tweet-{twid}', 'content', 'itemContent',
|
||||||
'tweet_results', 'result'
|
'tweet_results', 'result', ('tweet', None),
|
||||||
), expected_type=dict, default={}, get_all=False)
|
), expected_type=dict, default={}, get_all=False)
|
||||||
|
|
||||||
|
if result.get('__typename') not in ('Tweet', None):
|
||||||
|
self.report_warning(f'Unknown typename: {result.get("__typename")}', twid, only_once=True)
|
||||||
|
|
||||||
if 'tombstone' in result:
|
if 'tombstone' in result:
|
||||||
cause = traverse_obj(result, ('tombstone', 'text', 'text'), expected_type=str)
|
cause = traverse_obj(result, ('tombstone', 'text', 'text'), expected_type=str)
|
||||||
raise ExtractorError(f'Twitter API says: {cause or "Unknown error"}', expected=True)
|
raise ExtractorError(f'Twitter API says: {cause or "Unknown error"}', expected=True)
|
||||||
|
|
Loading…
Reference in a new issue