Skip to content

Commit

Permalink
[tumblrgallery] fix extraction (closes mikf#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Dec 17, 2021
1 parent 62692c6 commit 0d02a78
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions gallery_dl/extractor/tumblrgallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,16 @@ def images(self, _):
response = self.request(
"{}/tumblrblog/gallery/{}/{}.html"
.format(self.root, self.gallery_id, page_num),
allow_redirects=False
allow_redirects=False, fatal=False,
)
if response.status_code != 200:
return

page = response.text
page_num += 1

urls = list(text.extract_iter(
page,
'<div class="report xx-co-me"> <a href="',
'" data-fancybox="gallery"'
))
urls = text.extract_iter(
page, '<div class="report"> <a class="xx-co-me" href="', '"')

for image_src in urls:
yield image_src, {
Expand All @@ -66,7 +63,11 @@ class TumblrgalleryPostExtractor(TumblrgalleryExtractor):
"""Extractor for Posts on tumblrgallery.xyz"""
subcategory = "post"
pattern = BASE_PATTERN + r"(/post/(\d+)\.html)"
test = ("https://tumblrgallery.xyz/post/405674.html",)
test = ("https://tumblrgallery.xyz/post/405674.html", {
"pattern": r"https://78\.media\.tumblr\.com/bec67072219c1f3bc04fd9711d"
r"ec42ef/tumblr_p51qq1XCHS1txhgk3o1_1280\.jpg",
"count": 3,
})

def __init__(self, match):
TumblrgalleryExtractor.__init__(self, match)
Expand All @@ -81,11 +82,8 @@ def metadata(self, page):
}

def images(self, page):
urls = list(text.extract_iter(
page,
'<div class="report xx-co-me"> <a href="',
'" data-fancybox="gallery"'
))
urls = text.extract_iter(
page, '<div class="report"> <a class="xx-co-me" href="', '"')

for image_src in urls:
yield image_src, {
Expand Down

0 comments on commit 0d02a78

Please sign in to comment.