Skip to content

Commit

Permalink
[blogger] support new image domain (fixes mikf#2204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jan 20, 2022
1 parent c587b67 commit 698f352
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions gallery_dl/extractor/blogger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright 2019-2020 Mike Fährmann
# Copyright 2019-2022 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -41,9 +41,11 @@ def items(self):
blog["date"] = text.parse_datetime(blog["published"])
del blog["selfLink"]

sub = re.compile(r"/(?:s\d+|w\d+-h\d+)/").sub
sub = re.compile(r"(/|=)(?:s\d+|w\d+-h\d+)(?=/|$)").sub
findall_image = re.compile(
r'src="(https?://\d+\.bp\.blogspot\.com/[^"]+)').findall
r'src="(https?://(?:'
r'blogger\.googleusercontent\.com/img|'
r'\d+\.bp\.blogspot\.com)/[^"]+)').findall
findall_video = re.compile(
r'src="(https?://www\.blogger\.com/video\.g\?token=[^"]+)').findall

Expand All @@ -52,7 +54,7 @@ def items(self):

files = findall_image(content)
for idx, url in enumerate(files):
files[idx] = sub("/s0/", url).replace("http:", "https:", 1)
files[idx] = sub(r"\1s0", url).replace("http:", "https:", 1)

if self.videos and 'id="BLOG_video-' in content:
page = self.request(post["url"]).text
Expand Down Expand Up @@ -137,6 +139,12 @@ class BloggerPostExtractor(BloggerExtractor):
("https://aaaninja.blogspot.com/2020/08/altera-boob-press-2.html", {
"pattern": r"https://1.bp.blogspot.com/.+/s0/altera_.+png",
}),
# new image domain (#2204)
(("https://randomthingsthroughmyletterbox.blogspot.com/2022/01"
"/bitter-flowers-by-gunnar-staalesen-blog.html"), {
"pattern": r"https://blogger.googleusercontent.com/img/a/.+=s0$",
"count": 8,
}),
)

def __init__(self, match):
Expand Down

0 comments on commit 698f352

Please sign in to comment.