[chevereto] extract 'album_id' & 'album_slug' metadata (#8604)

This commit is contained in:
Mike Fährmann
2025-12-07 17:40:08 +01:00
parent 526a42a04d
commit d2b3eb6adb
3 changed files with 21 additions and 6 deletions

View File

@@ -74,15 +74,18 @@ class CheveretoImageExtractor(CheveretoExtractor):
url, b"seltilovessimpcity@simpcityhatesscrapers",
fromhex=True)
album_url, _, album_name = extr("Added to <a", "</a>").rpartition(">")
file = {
"id" : self.path.rpartition("/")[2].rpartition(".")[2],
"url" : url,
"album": text.remove_html(extr(
"Added to <a", "</a>").rpartition(">")[2]),
"album": text.remove_html(album_name),
"date" : self.parse_datetime_iso(extr('<span title="', '"')),
"user" : extr('username: "', '"'),
}
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
@@ -113,12 +116,17 @@ class CheveretoVideoExtractor(CheveretoExtractor):
'property="video:height" content="', '"')),
"duration" : extr(
'class="far fa-clock"></i>', ""),
"album": text.remove_html(extr(
"Added to <a", "</a>").rpartition(">")[2]),
"album" : extr(
"Added to <a", "</a>"),
"date" : self.parse_datetime_iso(extr('<span title="', '"')),
"user" : extr('username: "', '"'),
}
album_url, _, album_name = file["album"].rpartition(">")
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)