[weibo] add 'movies' option (#6988)

disable 'movie' downloads by default
This commit is contained in:
Mike Fährmann
2025-02-13 17:57:26 +01:00
parent b8b541fded
commit 51f978e027
4 changed files with 32 additions and 3 deletions

View File

@@ -488,7 +488,7 @@ Description
`cookies <extractor.*.cookies_>`__ is required
Note: Leave the ``password`` value empty or undefined
to be prompted for a passeword when performing a login
to be prompted for a password when performing a login
(see `getpass() <https://docs.python.org/3/library/getpass.html#getpass.getpass>`__).
@@ -4703,7 +4703,7 @@ Default
``true``
Description
When receiving a "Could not authenticate you" error while logged in with
`username & passeword <extractor.*.username & .password_>`__,
`username & password <extractor.*.username & .password_>`__,
refresh the current login session and
try to continue from where it left off.
@@ -5054,6 +5054,16 @@ Description
Download ``livephoto`` files.
extractor.weibo.movies
----------------------
Type
``bool``
Default
``false``
Description
Download ``movie`` videos.
extractor.weibo.retweets
------------------------
Type

View File

@@ -713,6 +713,7 @@
"gifs" : true,
"include" : ["feed"],
"livephoto": true,
"movies" : false,
"retweets" : false,
"videos" : true
},

View File

@@ -33,6 +33,7 @@ class WeiboExtractor(Extractor):
self.livephoto = self.config("livephoto", True)
self.retweets = self.config("retweets", False)
self.videos = self.config("videos", True)
self.movies = self.config("movies", False)
self.gifs = self.config("gifs", True)
self.gifs_video = (self.gifs == "video")
@@ -134,7 +135,10 @@ class WeiboExtractor(Extractor):
if "page_info" in status:
info = status["page_info"]
if "media_info" in info and self.videos:
append(self._extract_video(info["media_info"]))
if info.get("type") != "5" or self.movies:
append(self._extract_video(info["media_info"]))
else:
self.log.debug("%s: Ignoring 'movie' video", status["id"])
def _extract_video(self, info):
try:

View File

@@ -282,6 +282,20 @@ __tests__ = (
"#count" : 9,
},
{
"#url" : "https://weibo.com/1919017185/4246199458129705",
"#comment" : "'movie'-type video (#3793)",
"#category": ("", "weibo", "status"),
"#class" : weibo.WeiboStatusExtractor,
"#options" : {"movies": True},
"#urls" : (
"https://wx4.sinaimg.cn/large/7261e0e1gy1frvyc1xnkfj20qo0zkwjh.jpg",
"https://wx2.sinaimg.cn/large/7261e0e1gy1frvyc30b1jj20zk0qojwh.jpg",
"https://wx4.sinaimg.cn/large/7261e0e1gy1frvyc44lx8j20qo0zk7a6.jpg",
"https://gslb.miaopai.com/stream/KdhuavhOnJ7R6zJFXfEXm-sDthpmC5DIGqrdOg__.mp4?yx=&refer=weibo_app&tags=weibocard",
),
},
{
"#url" : "https://m.weibo.cn/status/4339748116375525",
"#category": ("", "weibo", "status"),