1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 04:32:51 +01:00

[livedoor] fix adjustments for https:// URLs

This commit is contained in:
Mike Fährmann 2019-05-25 23:35:20 +02:00
parent 2316e0ed3d
commit e88824e1a7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -16,7 +16,6 @@ class LivedoorExtractor(Extractor):
"""Base class for livedoor extractors"""
category = "livedoor"
root = "http://blog.livedoor.jp"
img_root = "http://livedoor.blogimg.jp"
filename_fmt = "{post[id]}_{post[title]}_{num:>02}.{extension}"
directory_fmt = ("{category}", "{post[user]}")
archive_fmt = "{post[id]}_{hash}"
@ -59,7 +58,7 @@ class LivedoorExtractor(Extractor):
src = text.extract(img, 'src="', '"')[0]
alt = text.extract(img, 'alt="', '"')[0]
if src.startswith(self.img_root):
if "://livedoor.blogimg.jp/" in src:
url = src.replace("-s.", ".")
else:
url = text.urljoin(self.root, src)
@ -84,7 +83,7 @@ class LivedoorBlogExtractor(LivedoorExtractor):
test = ("http://blog.livedoor.jp/zatsu_ke/", {
"range": "1-50",
"count": 50,
"pattern": r"http://livedoor.blogimg.jp/zatsu_ke/imgs/\w/\w/\w+\.\w+",
"pattern": r"https?://livedoor.blogimg.jp/\w+/imgs/\w/\w/\w+\.\w+",
"keyword": {
"post": {
"categories": list,