Skip to content

Commit

Permalink
[weibo] add 'movies' option (#6988)
Browse files Browse the repository at this point in the history
disable 'movie' downloads by default
  • Loading branch information
mikf committed Feb 13, 2025
1 parent b8b541f commit 51f978e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
14 changes: 12 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>`__).


Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -5054,6 +5054,16 @@ Description
Download ``livephoto`` files.


extractor.weibo.movies
----------------------
Type
``bool``
Default
``false``
Description
Download ``movie`` videos.


extractor.weibo.retweets
------------------------
Type
Expand Down
1 change: 1 addition & 0 deletions docs/gallery-dl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
"gifs" : true,
"include" : ["feed"],
"livephoto": true,
"movies" : false,
"retweets" : false,
"videos" : true
},
Expand Down
6 changes: 5 additions & 1 deletion gallery_dl/extractor/weibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def _init(self):
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")

Expand Down Expand Up @@ -134,7 +135,10 @@ def _extract_status(self, status, files):
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:
Expand Down
14 changes: 14 additions & 0 deletions test/results/weibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,20 @@
"#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"),
Expand Down

0 comments on commit 51f978e

Please sign in to comment.