[twitter] general support for unified cards (#2875)

just removing the 'type' check seems to work
This commit is contained in:
Mike Fährmann 2022-08-30 18:14:06 +02:00
parent 8839b0d2ee
commit 4d7cb0bf56
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -208,9 +208,7 @@ class TwitterExtractor(Extractor):
else:
bval = bvals["unified_card"]["string_value"]
data = json.loads(bval)
if data.get("type") in ("image_website", "image_carousel_website"):
self._extract_media(
tweet, data["media_entities"].values(), files)
self._extract_media(tweet, data["media_entities"].values(), files)
return
if self.cards == "ytdl":
@ -735,18 +733,23 @@ class TwitterTweetExtractor(TwitterExtractor):
"options": (("cards", True),),
"pattern": r"https://pbs.twimg.com/card_img/\d+/",
}),
# image_website unified_card (#2875)
# unified_card image_website (#2875)
("https://twitter.com/i/web/status/1561674543323910144", {
"options": (("cards", True),),
"pattern": r"https://pbs\.twimg\.com/media/F.+=jpg",
"count": 1,
}),
# image_carousel_website unified_card
# unified_card image_carousel_website
("https://twitter.com/doax_vv_staff/status/1479438945662685184", {
"options": (("cards", True),),
"pattern": r"https://pbs\.twimg\.com/media/F.+=png",
"count": 6,
}),
# unified_card video_website (#2875)
("https://twitter.com/bang_dream_1242/status/1561548715348746241", {
"options": (("cards", True),),
"pattern": r"https://video\.twimg\.com/amplify_video"
r"/1560607284333449216/vid/720x720/\w+\.mp4",
}),
# unified_card without type
("https://twitter.com/i/web/status/1466183847628865544", {
"count": 0,