From 708f478d158d4471a7c2ba3551b4f144a7f9c138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 11 May 2023 15:59:42 +0200 Subject: [PATCH] [danbooru][e621] add 'date' metadata field (#4047) --- gallery_dl/extractor/danbooru.py | 5 ++++- gallery_dl/extractor/e621.py | 3 +++ gallery_dl/version.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/danbooru.py b/gallery_dl/extractor/danbooru.py index 326b53b4..ab23520a 100644 --- a/gallery_dl/extractor/danbooru.py +++ b/gallery_dl/extractor/danbooru.py @@ -70,6 +70,8 @@ class DanbooruExtractor(BaseExtractor): continue 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 self.ugoira: @@ -181,7 +183,7 @@ class DanbooruTagExtractor(DanbooruExtractor): "count": 12, }), ("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+", "count": ">= 3", }), @@ -245,6 +247,7 @@ class DanbooruPostExtractor(DanbooruExtractor): test = ( ("https://danbooru.donmai.us/posts/294929", { "content": "5e255713cbf0a8e0801dc423563c34d896bb9229", + "keyword": {"date": "dt:2008-08-12 04:46:05"}, }), ("https://danbooru.donmai.us/posts/3613024", { "pattern": r"https?://.+\.zip$", diff --git a/gallery_dl/extractor/e621.py b/gallery_dl/extractor/e621.py index 8f2994e4..65ef1e1c 100644 --- a/gallery_dl/extractor/e621.py +++ b/gallery_dl/extractor/e621.py @@ -57,6 +57,8 @@ class E621Extractor(danbooru.DanbooruExtractor): post["filename"] = file["md5"] post["extension"] = file["ext"] + post["date"] = text.parse_datetime( + post["created_at"], "%Y-%m-%dT%H:%M:%S.%f%z") post.update(data) yield Message.Directory, post @@ -140,6 +142,7 @@ class E621PostExtractor(E621Extractor, danbooru.DanbooruPostExtractor): ("https://e621.net/posts/535", { "url": "f7f78b44c9b88f8f09caac080adc8d6d9fdaa529", "content": "66f46e96a893fba8e694c4e049b23c2acc9af462", + "keyword": {"date": "dt:2007-02-17 19:02:32"}, }), ("https://e621.net/posts/3181052", { "options": (("metadata", "notes,pools"),), diff --git a/gallery_dl/version.py b/gallery_dl/version.py index 4f9e49a2..8d4c98a5 100644 --- a/gallery_dl/version.py +++ b/gallery_dl/version.py @@ -6,4 +6,4 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -__version__ = "1.25.4" +__version__ = "1.25.5-dev"