[twitter] changes to 'cards' option
- change default value to 'true'
- only invoke youtube-dl for cards unsupported by gallery
when 'cards' is set to "ytdl"
"cards": true --> only download card images
"cards": "ytdl" --> download card images and
use youtube_dl on otherwise unsupported cards
This commit is contained in:
@@ -2030,11 +2030,15 @@ Description
|
|||||||
extractor.twitter.cards
|
extractor.twitter.cards
|
||||||
-----------------------
|
-----------------------
|
||||||
Type
|
Type
|
||||||
``bool``
|
``bool`` or ``string``
|
||||||
Default
|
Default
|
||||||
``false``
|
``true``
|
||||||
Description
|
Description
|
||||||
Fetch media from `Cards <https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards>`__.
|
Controls how to handle `Twitter Cards <https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards>`__.
|
||||||
|
|
||||||
|
* ``false``: Ignore cards
|
||||||
|
* ``true``: Download image content from supported cards
|
||||||
|
* ``"ytdl"``: Additionally download video content from unsupported cards using `youtube-dl`_
|
||||||
|
|
||||||
|
|
||||||
extractor.twitter.conversations
|
extractor.twitter.conversations
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
{
|
{
|
||||||
"username": null,
|
"username": null,
|
||||||
"password": null,
|
"password": null,
|
||||||
"cards": false,
|
"cards": true,
|
||||||
"conversations": false,
|
"conversations": false,
|
||||||
"pinned": false,
|
"pinned": false,
|
||||||
"quoted": false,
|
"quoted": false,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class TwitterExtractor(Extractor):
|
|||||||
self.pinned = self.config("pinned", False)
|
self.pinned = self.config("pinned", False)
|
||||||
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", True)
|
||||||
self._user_cache = {}
|
self._user_cache = {}
|
||||||
self._init_sizes()
|
self._init_sizes()
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ class TwitterExtractor(Extractor):
|
|||||||
tweet, data["media_entities"].values(), files)
|
tweet, data["media_entities"].values(), files)
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.videos:
|
if self.cards == "ytdl":
|
||||||
url = "ytdl:{}/i/web/status/{}".format(self.root, tweet["id_str"])
|
url = "ytdl:{}/i/web/status/{}".format(self.root, tweet["id_str"])
|
||||||
files.append({"url": url})
|
files.append({"url": url})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user