1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 04:32:51 +01:00

[danbooru][e621] add 'date' metadata field (#4047)

This commit is contained in:
Mike Fährmann 2023-05-11 15:59:42 +02:00
parent 306e13a4d4
commit 708f478d15
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 8 additions and 2 deletions

View File

@ -70,6 +70,8 @@ class DanbooruExtractor(BaseExtractor):
continue continue
text.nameext_from_url(url, post) text.nameext_from_url(url, post)
post["date"] = text.parse_datetime(
post["created_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
if post["extension"] == "zip": if post["extension"] == "zip":
if self.ugoira: if self.ugoira:
@ -181,7 +183,7 @@ class DanbooruTagExtractor(DanbooruExtractor):
"count": 12, "count": 12,
}), }),
("https://aibooru.online/posts?tags=center_frills&z=1", { ("https://aibooru.online/posts?tags=center_frills&z=1", {
"pattern": r"https://aibooru\.online/data/original" "pattern": r"https://cdn\.aibooru\.online/original"
r"/[0-9a-f]{2}/[0-9a-f]{2}/[0-9a-f]{32}\.\w+", r"/[0-9a-f]{2}/[0-9a-f]{2}/[0-9a-f]{32}\.\w+",
"count": ">= 3", "count": ">= 3",
}), }),
@ -245,6 +247,7 @@ class DanbooruPostExtractor(DanbooruExtractor):
test = ( test = (
("https://danbooru.donmai.us/posts/294929", { ("https://danbooru.donmai.us/posts/294929", {
"content": "5e255713cbf0a8e0801dc423563c34d896bb9229", "content": "5e255713cbf0a8e0801dc423563c34d896bb9229",
"keyword": {"date": "dt:2008-08-12 04:46:05"},
}), }),
("https://danbooru.donmai.us/posts/3613024", { ("https://danbooru.donmai.us/posts/3613024", {
"pattern": r"https?://.+\.zip$", "pattern": r"https?://.+\.zip$",

View File

@ -57,6 +57,8 @@ class E621Extractor(danbooru.DanbooruExtractor):
post["filename"] = file["md5"] post["filename"] = file["md5"]
post["extension"] = file["ext"] post["extension"] = file["ext"]
post["date"] = text.parse_datetime(
post["created_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
post.update(data) post.update(data)
yield Message.Directory, post yield Message.Directory, post
@ -140,6 +142,7 @@ class E621PostExtractor(E621Extractor, danbooru.DanbooruPostExtractor):
("https://e621.net/posts/535", { ("https://e621.net/posts/535", {
"url": "f7f78b44c9b88f8f09caac080adc8d6d9fdaa529", "url": "f7f78b44c9b88f8f09caac080adc8d6d9fdaa529",
"content": "66f46e96a893fba8e694c4e049b23c2acc9af462", "content": "66f46e96a893fba8e694c4e049b23c2acc9af462",
"keyword": {"date": "dt:2007-02-17 19:02:32"},
}), }),
("https://e621.net/posts/3181052", { ("https://e621.net/posts/3181052", {
"options": (("metadata", "notes,pools"),), "options": (("metadata", "notes,pools"),),

View File

@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
__version__ = "1.25.4" __version__ = "1.25.5-dev"