mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
[weibo] fix livephoto 'filename' & 'extension' (#6471)
This commit is contained in:
parent
a3276e3b5d
commit
396b52aef7
@ -127,10 +127,14 @@ class WeiboExtractor(Extractor):
|
|||||||
elif pic_type == "livephoto" and self.livephoto:
|
elif pic_type == "livephoto" and self.livephoto:
|
||||||
append(pic["largest"].copy())
|
append(pic["largest"].copy())
|
||||||
|
|
||||||
file = {"url": pic["video"]}
|
url = pic["video"]
|
||||||
file["filename"], _, file["extension"] = \
|
fname, _, ext = (
|
||||||
pic["video"].rpartition("%2F")[2].rpartition(".")
|
url.rpartition("%2F")[2]
|
||||||
append(file)
|
if "%2F" in url else
|
||||||
|
text.filename_from_url(url)
|
||||||
|
).rpartition(".")
|
||||||
|
|
||||||
|
append({"url": url, "filename": fname, "extension": ext})
|
||||||
|
|
||||||
else:
|
else:
|
||||||
append(pic["largest"].copy())
|
append(pic["largest"].copy())
|
||||||
@ -251,8 +255,10 @@ class WeiboUserExtractor(WeiboExtractor):
|
|||||||
pattern = USER_PATTERN + r"(?:$|#)"
|
pattern = USER_PATTERN + r"(?:$|#)"
|
||||||
example = "https://weibo.com/USER"
|
example = "https://weibo.com/USER"
|
||||||
|
|
||||||
def initialize(self):
|
# do NOT override 'initialize()'
|
||||||
pass
|
# it is needed for 'self._user_id()'
|
||||||
|
# def initialize(self):
|
||||||
|
# pass
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
base = "{}/u/{}?tabtype=".format(self.root, self._user_id())
|
base = "{}/u/{}?tabtype=".format(self.root, self._user_id())
|
||||||
|
@ -227,13 +227,14 @@ __tests__ = (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://weibo.com/5643044717/KkuDZ4jAA",
|
"#url" : "https://weibo.com/3194672795/OuxSwgUrC",
|
||||||
"#comment" : "type == livephoto (#2146)",
|
"#comment" : "type == livephoto (#2146, #6471)",
|
||||||
"#category": ("", "weibo", "status"),
|
"#category": ("", "weibo", "status"),
|
||||||
"#class" : weibo.WeiboStatusExtractor,
|
"#class" : weibo.WeiboStatusExtractor,
|
||||||
"#pattern" : r"https://video\.weibo\.com/media/play\?livephoto=https%3A%2F%2Fus\.sinaimg\.cn%2F\w+\.mov",
|
"#pattern" : r"https://livephoto\.us\.sinaimg\.cn/\w+\.mov\?Expires=\d+&ssig=\w+&KID=unistore,video",
|
||||||
"#range" : "2,4,6",
|
"#range" : "2,4",
|
||||||
|
|
||||||
|
"filename" : {"000yfKhRjx08hBAXxdZ60f0f0100tBPr0k01", "000GEYrCjx08hBAXUFo40f0f0100vS5G0k01"},
|
||||||
"extension": "mov",
|
"extension": "mov",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user