[chevereto] extract 'album_id' & 'album_slug' metadata (#8604)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -37,6 +37,8 @@ __tests__ = (
|
||||
"#results" : "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.mp4",
|
||||
|
||||
"album" : "",
|
||||
"album_id" : "",
|
||||
"album_slug": "",
|
||||
"date" : "dt:2025-08-29 18:01:20",
|
||||
"duration" : 7,
|
||||
"extension": "mp4",
|
||||
|
||||
@@ -16,6 +16,8 @@ __tests__ = (
|
||||
"#sha1_content": "098e5e9b17ad634358426e0ffd1c93871474d13c",
|
||||
|
||||
"album" : "",
|
||||
"album_id" : "",
|
||||
"album_slug": "",
|
||||
"date" : "dt:2022-06-05 03:24:25",
|
||||
"extension": "jpg",
|
||||
"filename" : "funnymeme",
|
||||
@@ -62,8 +64,11 @@ __tests__ = (
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#results" : "https://simp2.selti-delivery.ru/hannahowo_00457.jpg",
|
||||
|
||||
"album": "401-500",
|
||||
"date" : "dt:2022-03-23 13:50:52",
|
||||
"album" : "401-500",
|
||||
"album_id" : "atYaG",
|
||||
"album_slug": "401-500",
|
||||
"date" : "dt:2022-03-23 13:50:52",
|
||||
"id" : "auCruA",
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user