1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

[weibo] simplify 'livephoto' extraction (#6471)

continuation of 396b52aef7

fixes wrong 'filename' and 'extension' values
when 'ssig' query parameter contains "%2F"
This commit is contained in:
Mike Fährmann 2024-11-16 07:40:39 +01:00
parent cb09273670
commit f7246f025f
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 2 additions and 10 deletions

View File

@ -126,15 +126,7 @@ 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())
append({"url": pic["video"]})
url = pic["video"]
fname, _, ext = (
url.rpartition("%2F")[2]
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())

View File

@ -231,7 +231,7 @@ __tests__ = (
"#comment" : "type == livephoto (#2146, #6471)", "#comment" : "type == livephoto (#2146, #6471)",
"#category": ("", "weibo", "status"), "#category": ("", "weibo", "status"),
"#class" : weibo.WeiboStatusExtractor, "#class" : weibo.WeiboStatusExtractor,
"#pattern" : r"https://livephoto\.us\.sinaimg\.cn/\w+\.mov\?Expires=\d+&ssig=\w+&KID=unistore,video", "#pattern" : r"https://livephoto\.us\.sinaimg\.cn/\w+\.mov\?Expires=\d+&ssig=[^&#]+&KID=unistore,video",
"#range" : "2,4", "#range" : "2,4",
"filename" : {"000yfKhRjx08hBAXxdZ60f0f0100tBPr0k01", "000GEYrCjx08hBAXUFo40f0f0100vS5G0k01"}, "filename" : {"000yfKhRjx08hBAXxdZ60f0f0100tBPr0k01", "000GEYrCjx08hBAXUFo40f0f0100vS5G0k01"},