From 41998cbb8fc8382dec9e33e666bd26f2542bf673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 14 Feb 2026 19:21:35 +0100 Subject: [PATCH] [chevereto] combine 'image' & 'video' extractors into a 'file' extractor --- docs/supportedsites.md | 6 +- gallery_dl/extractor/chevereto.py | 143 +++++++++++++----------------- test/results/imagepond.py | 15 ++-- test/results/imglike.py | 10 +-- test/results/jpgfish.py | 49 +++++----- 5 files changed, 106 insertions(+), 117 deletions(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index afb3a36d..4e76732a 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -1360,19 +1360,19 @@ Consider all listed sites to potentially be NSFW. JPG Fish https://jpg7.cr/ - Albums, Categories, individual Images, User Profiles, Videos + Albums, Categories, Files, User Profiles ImagePond https://imagepond.net/ - Albums, Categories, individual Images, User Profiles, Videos + Albums, Categories, Files, User Profiles Nude Celeb https://imglike.com/ - Albums, Categories, individual Images, User Profiles, Videos + Albums, Categories, Files, User Profiles diff --git a/gallery_dl/extractor/chevereto.py b/gallery_dl/extractor/chevereto.py index b7abfed1..4b69b9bd 100644 --- a/gallery_dl/extractor/chevereto.py +++ b/gallery_dl/extractor/chevereto.py @@ -98,10 +98,10 @@ BASE_PATTERN = CheveretoExtractor.update({ }) -class CheveretoImageExtractor(CheveretoExtractor): - """Extractor for chevereto images""" - subcategory = "image" - pattern = BASE_PATTERN + r"(/im(?:g|age)/[^/?#]+)" +class CheveretoFileExtractor(CheveretoExtractor): + """Extractor for chevereto files""" + subcategory = "file" + pattern = BASE_PATTERN + r"(/(?:im(?:g|age)|video)/[^/?#]+)" example = "https://jpg7.cr/img/TITLE.ID" def items(self): @@ -109,76 +109,67 @@ class CheveretoImageExtractor(CheveretoExtractor): page = self.request(url).text extr = text.extract_from(page) + type = text.extr(page, 'property="og:type" content="', '"') title = extr('property="og:title" content="', '"') - url = (extr('").rpartition(">") - file = { - "id" : self.path.rpartition("/")[2].rpartition(".")[2], - "url" : url, - "title": text.unescape(title), - "album": text.remove_html(album_name), - "date" : self.parse_datetime_iso(extr('', "—"), + "album" : extr( + "Added to "), + "date" : self.parse_datetime_iso(extr( + '") + file["album"] = text.remove_html(album_name) + file["album_slug"], _, file["album_id"] = text.rextr( + album_url, "/", '"').rpartition(".") - text.nameext_from_url(file["url"], file) - yield Message.Directory, "", file - yield Message.Url, file["url"], file + try: + min, _, sec = file["duration"].partition(":") + file["duration"] = int(min) * 60 + int(sec) + except Exception: + pass + else: + url = (extr('").rpartition(">") + file = { + "id" : self.path.rpartition("/")[2].rpartition(".")[2], + "url" : url, + "type" : type, + "title": text.unescape(title), + "album": text.remove_html(album_name), + "date" : self.parse_datetime_iso(extr('', "—"), - "album" : extr( - "Added to "), - "date" : self.parse_datetime_iso(extr('") - file["album"] = text.remove_html(album_name) - file["album_slug"], _, file["album_id"] = text.rextr( - album_url, "/", '"').rpartition(".") - - try: - min, _, sec = file["duration"].partition(":") - file["duration"] = int(min) * 60 + int(sec) - except Exception: - pass + file["album_slug"], _, file["album_id"] = text.rextr( + album_url, "/", '"').rpartition(".") text.nameext_from_url(file["url"], file) yield Message.Directory, "", file @@ -193,19 +184,16 @@ class CheveretoAlbumExtractor(CheveretoExtractor): def items(self): url = self.root + self.path - data_image = {"_extractor": CheveretoImageExtractor} - data_video = {"_extractor": CheveretoVideoExtractor} + data = {"_extractor": CheveretoFileExtractor} if self.path.endswith("/sub"): albums = self._pagination(url) else: albums = (url,) - kwdict = self.kwdict for album in albums: - for kwdict["num"], item_url in enumerate(self._pagination( + for self.kwdict["num"], item_url in enumerate(self._pagination( album, self._extract_metadata_album), 1): - data = data_video if "/video/" in item_url else data_image yield Message.Queue, item_url, data def _extract_metadata_album(self, page): @@ -229,7 +217,7 @@ class CheveretoCategoryExtractor(CheveretoExtractor): example = "https://imglike.com/category/TITLE" def items(self): - data = {"_extractor": CheveretoImageExtractor} + data = {"_extractor": CheveretoFileExtractor} for image in self._pagination(self.root + self.path): yield Message.Queue, image, data @@ -241,11 +229,8 @@ class CheveretoUserExtractor(CheveretoExtractor): example = "https://jpg7.cr/USER" def items(self): - data_image = {"_extractor": CheveretoImageExtractor} - data_video = {"_extractor": CheveretoVideoExtractor} + data_file = {"_extractor": CheveretoFileExtractor} data_album = {"_extractor": CheveretoAlbumExtractor} for url in self._pagination(self.root + self.path): - data = (data_album if "/album/" in url else - data_video if "/video/" in url else - data_image) + data = data_album if "/album/" in url else data_file yield Message.Queue, url, data diff --git a/test/results/imagepond.py b/test/results/imagepond.py index 65101e38..f7ae0ad6 100644 --- a/test/results/imagepond.py +++ b/test/results/imagepond.py @@ -10,8 +10,8 @@ from gallery_dl.extractor import chevereto __tests__ = ( { "#url" : "https://imagepond.net/image/IMG-20250217-160622.TJNphg", - "#category": ("chevereto", "imagepond", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "imagepond", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://media.imagepond.net/media/IMG_20250217_1606226b345a5dbd0e8971.jpg", "#sha1_content": "ec7fac6b427f7af01038619208cd69478e91ddef", @@ -20,20 +20,22 @@ __tests__ = ( "extension": "jpg", "filename" : "IMG_20250217_1606226b345a5dbd0e8971", "id" : "TJNphg", + "title" : "IMG_20250217_160622.jpg", + "type" : "image", "url" : "https://media.imagepond.net/media/IMG_20250217_1606226b345a5dbd0e8971.jpg", "user" : "dariusbbb24", }, { "#url" : "https://www.imagepond.net/image/IMG-20250217-160622.TJNphg", - "#category": ("chevereto", "imagepond", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "imagepond", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://imagepond.net/video/1000423939.zb8Fxy", - "#category": ("chevereto", "imagepond", "video"), - "#class" : chevereto.CheveretoVideoExtractor, + "#category": ("chevereto", "imagepond", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.mp4", "album" : "", @@ -47,6 +49,7 @@ __tests__ = ( "id" : "zb8Fxy", "thumbnail": "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.fr.jpeg", "title" : "1000423939", + "type" : "video", "url" : "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.mp4", "user" : "christiankita", "width" : 720, diff --git a/test/results/imglike.py b/test/results/imglike.py index 5772e70d..c20d2589 100644 --- a/test/results/imglike.py +++ b/test/results/imglike.py @@ -10,8 +10,8 @@ from gallery_dl.extractor import chevereto __tests__ = ( { "#url" : "https://imglike.com/image/EMT-Skills-Verification-by-EMSA.Lx6dT", - "#category": ("chevereto", "imglike", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "imglike", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://imglike.com/images/2022/08/12/EMT-Skills-Verification-by-EMSA.gif", "album" : "", @@ -25,8 +25,8 @@ __tests__ = ( { "#url" : "https://www.imglike.com/image/EMT-Skills-Verification-by-EMSA.Lx6dT", - "#category": ("chevereto", "imglike", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "imglike", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { @@ -59,7 +59,7 @@ __tests__ = ( "#url" : "https://imglike.com/category/Bursting-boobs", "#category": ("chevereto", "imglike", "category"), "#class" : chevereto.CheveretoCategoryExtractor, - "#pattern" : chevereto.CheveretoImageExtractor.pattern, + "#pattern" : chevereto.CheveretoFileExtractor.pattern, "#range" : "1-100", "#count" : 100, }, diff --git a/test/results/jpgfish.py b/test/results/jpgfish.py index 66696c0f..f8eaebba 100644 --- a/test/results/jpgfish.py +++ b/test/results/jpgfish.py @@ -10,8 +10,8 @@ from gallery_dl.extractor import chevereto __tests__ = ( { "#url" : "https://jpg7.cr/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg", "#sha1_content": "098e5e9b17ad634358426e0ffd1c93871474d13c", @@ -23,14 +23,15 @@ __tests__ = ( "filename" : "funnymeme", "id" : "LecXGS", "title" : "funnymeme", + "type" : "article", "url" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg", "user" : "exearco", }, { "#url" : "https://jpg4.su/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg", "album" : "", @@ -45,8 +46,8 @@ __tests__ = ( { "#url" : "https://jpg6.su/img/LecXGS/", "#comment" : "image ID without name (#8307)", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg", "#sha1_content": "098e5e9b17ad634358426e0ffd1c93871474d13c", @@ -61,8 +62,8 @@ __tests__ = ( { "#url" : "https://jpg.church/img/auCruA", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://simp2.selti-delivery.ru/hannahowo_00457.jpg", "album" : "401-500", @@ -74,50 +75,50 @@ __tests__ = ( { "#url" : "https://jpg1.su/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://jpeg.pet/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://jpg.pet/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://jpg.fishing/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://jpg.fish/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://jpg.church/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://www.jpg6.su/img/funnymeme.LecXGS", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, }, { "#url" : "https://jpg6.su/img/test.NLqFQHc", - "#category": ("chevereto", "jpgfish", "image"), - "#class" : chevereto.CheveretoImageExtractor, + "#category": ("chevereto", "jpgfish", "file"), + "#class" : chevereto.CheveretoFileExtractor, "#results" : "https://simp6.selti-delivery.ru/images3/test--2219f2531862b749d5.png", "album" : "",