From f7246f025fa30e2132542913cc8271f1e155b298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 16 Nov 2024 07:40:39 +0100 Subject: [PATCH] [weibo] simplify 'livephoto' extraction (#6471) continuation of 396b52aef70b45bc03711a5555e15f9f1d8f7162 fixes wrong 'filename' and 'extension' values when 'ssig' query parameter contains "%2F" --- gallery_dl/extractor/weibo.py | 10 +--------- test/results/weibo.py | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/gallery_dl/extractor/weibo.py b/gallery_dl/extractor/weibo.py index b681002f..9885d79f 100644 --- a/gallery_dl/extractor/weibo.py +++ b/gallery_dl/extractor/weibo.py @@ -126,15 +126,7 @@ class WeiboExtractor(Extractor): elif pic_type == "livephoto" and self.livephoto: append(pic["largest"].copy()) - - 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}) + append({"url": pic["video"]}) else: append(pic["largest"].copy()) diff --git a/test/results/weibo.py b/test/results/weibo.py index a27a26e9..e9d8d644 100644 --- a/test/results/weibo.py +++ b/test/results/weibo.py @@ -231,7 +231,7 @@ __tests__ = ( "#comment" : "type == livephoto (#2146, #6471)", "#category": ("", "weibo", "status"), "#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", "filename" : {"000yfKhRjx08hBAXxdZ60f0f0100tBPr0k01", "000GEYrCjx08hBAXUFo40f0f0100vS5G0k01"},