mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
[telegraph] fix extraction when images not in <figure> (#3590)
This commit is contained in:
parent
0f7e6c422a
commit
489c51cecc
@ -68,6 +68,21 @@ class TelegraphGalleryExtractor(GalleryExtractor):
|
||||
"title": "Всё о друзьях моей сестрицы",
|
||||
},
|
||||
}),
|
||||
("https://telegra.ph/Disharmonica---Saber-Nero-02-21", {
|
||||
"pattern": r"https://telegra\.ph/file/[0-9a-f]+\.(jpg|png)",
|
||||
"keyword": {
|
||||
"author": "cosmos",
|
||||
"caption": "",
|
||||
"count": 89,
|
||||
"date": "dt:2022-02-21 05:57:39",
|
||||
"description": "",
|
||||
"num_formatted": r"re:^\d{2}$",
|
||||
"post_url": "https://telegra.ph"
|
||||
"/Disharmonica---Saber-Nero-02-21",
|
||||
"slug": "Disharmonica---Saber-Nero-02-21",
|
||||
"title": "Disharmonica - Saber Nero",
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
def metadata(self, page):
|
||||
@ -89,7 +104,8 @@ class TelegraphGalleryExtractor(GalleryExtractor):
|
||||
return data
|
||||
|
||||
def images(self, page):
|
||||
figures = tuple(text.extract_iter(page, "<figure>", "</figure>"))
|
||||
figures = (tuple(text.extract_iter(page, "<figure>", "</figure>")) or
|
||||
tuple(text.extract_iter(page, "<img", ">")))
|
||||
num_zeroes = len(str(len(figures)))
|
||||
num = 0
|
||||
|
||||
@ -105,7 +121,7 @@ class TelegraphGalleryExtractor(GalleryExtractor):
|
||||
|
||||
result.append((url, {
|
||||
"url" : url,
|
||||
"caption" : text.unescape(caption),
|
||||
"caption" : text.unescape(caption) if caption else "",
|
||||
"num" : num,
|
||||
"num_formatted": str(num).zfill(num_zeroes),
|
||||
}))
|
||||
|
Loading…
Reference in New Issue
Block a user