From 489c51cecc30fca949e11db7f7a8ec00d3c440fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 31 Jan 2023 22:09:02 +0100 Subject: [PATCH] [telegraph] fix extraction when images not in
(#3590) --- gallery_dl/extractor/telegraph.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/telegraph.py b/gallery_dl/extractor/telegraph.py index 5996268d..116f3afa 100644 --- a/gallery_dl/extractor/telegraph.py +++ b/gallery_dl/extractor/telegraph.py @@ -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, "
", "
")) + figures = (tuple(text.extract_iter(page, "
", "
")) or + tuple(text.extract_iter(page, ""))) 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), }))