[audiochan] extract 'description' texts (#6582)

https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3643689186
This commit is contained in:
Mike Fährmann
2025-12-12 09:13:07 +01:00
parent ab2c03b39e
commit 739e940a95
2 changed files with 19 additions and 0 deletions

View File

@@ -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"

View File

@@ -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,
},