[twitter] add 'cards-blacklist' option (#2875)
This commit is contained in:
@@ -2343,6 +2343,16 @@ Description
|
|||||||
* ``"ytdl"``: Additionally download video content from unsupported cards using `youtube-dl`_
|
* ``"ytdl"``: Additionally download video content from unsupported cards using `youtube-dl`_
|
||||||
|
|
||||||
|
|
||||||
|
extractor.twitter.cards-blacklist
|
||||||
|
---------------------------------
|
||||||
|
Type
|
||||||
|
``list`` of ``strings``
|
||||||
|
Example
|
||||||
|
``["player", "summary"]``
|
||||||
|
Description
|
||||||
|
List of card types to ignore
|
||||||
|
|
||||||
|
|
||||||
extractor.twitter.conversations
|
extractor.twitter.conversations
|
||||||
-------------------------------
|
-------------------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class TwitterExtractor(Extractor):
|
|||||||
self.quoted = self.config("quoted", False)
|
self.quoted = self.config("quoted", False)
|
||||||
self.videos = self.config("videos", True)
|
self.videos = self.config("videos", True)
|
||||||
self.cards = self.config("cards", False)
|
self.cards = self.config("cards", False)
|
||||||
|
self.cards_blacklist = self.config("cards-blacklist") or ()
|
||||||
self._user = self._user_obj = None
|
self._user = self._user_obj = None
|
||||||
self._user_cache = {}
|
self._user_cache = {}
|
||||||
self._init_sizes()
|
self._init_sizes()
|
||||||
@@ -174,7 +175,10 @@ class TwitterExtractor(Extractor):
|
|||||||
card = tweet["card"]
|
card = tweet["card"]
|
||||||
if "legacy" in card:
|
if "legacy" in card:
|
||||||
card = card["legacy"]
|
card = card["legacy"]
|
||||||
name = card["name"]
|
|
||||||
|
name = card["name"].rpartition(":")[2]
|
||||||
|
if name in self.cards_blacklist:
|
||||||
|
return
|
||||||
|
|
||||||
if name in ("summary", "summary_large_image"):
|
if name in ("summary", "summary_large_image"):
|
||||||
bvals = card["binding_values"]
|
bvals = card["binding_values"]
|
||||||
|
|||||||
Reference in New Issue
Block a user