From 739e940a9562f00a9bfb98669096aedeaef76014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 12 Dec 2025 09:13:07 +0100 Subject: [PATCH] [audiochan] extract 'description' texts (#6582) https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3643689186 --- gallery_dl/extractor/audiochan.py | 14 ++++++++++++++ test/results/audiochan.py | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/gallery_dl/extractor/audiochan.py b/gallery_dl/extractor/audiochan.py index e6133839..55d25279 100644 --- a/gallery_dl/extractor/audiochan.py +++ b/gallery_dl/extractor/audiochan.py @@ -48,6 +48,8 @@ class AudiochanExtractor(Extractor): post["_http_headers"] = self.headers_dl post["date"] = self.parse_datetime_iso(file["created_at"]) post["date_updated"] = self.parse_datetime_iso(file["updated_at"]) + post["description"] = self._extract_description( + post["description"]) tags = [] for tag in post["tags"]: @@ -86,6 +88,18 @@ class AudiochanExtractor(Extractor): break params["page"] += 1 + def _extract_description(self, description, asd=None): + if asd is None: + asd = [] + + if "text" in description: + asd.append(description["text"]) + elif "content" in description: + for desc in description["content"]: + self._extract_description(desc, asd) + + return asd + class AudiochanAudioExtractor(AudiochanExtractor): subcategory = "audio" diff --git a/test/results/audiochan.py b/test/results/audiochan.py index b6cd1595..35903b45 100644 --- a/test/results/audiochan.py +++ b/test/results/audiochan.py @@ -14,6 +14,10 @@ __tests__ = ( "#pattern" : r"https://stream.audiochan.com/v\?token=YXVkaW9zL2Q4YjA1ZWEzLWU0ZGItNGU2NC05MzZiLTQzNmI3MmM4OTViMS9sOTBCOFI0ajhjS0NFSmNwa2kubXAz&exp=\d+&st=.+", "#count" : 1, + "description": [ + "author summary: ", + "You wake up in the middle of the night, noticing that your boyfriend is still awake and restlessly moving around. Work-related worries are making him anxious and keeping him from falling asleep so you do your best to take care of him, calm him down, and help him get some rest." + ], "user": { "username": "lil_lovergirl", }, @@ -59,6 +63,7 @@ __tests__ = ( "#count" : range(25, 40), "search_tags": "Cozy", + "description": list, "user": dict, "tags": list, },