From 8876272e3cc14733e51ba2e5a6d07705a16fec3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 10 Nov 2025 19:10:37 +0100 Subject: [PATCH] [misskey] add 'date-min' & 'date-max' options (#8516) TODO: implement 'order-posts' option --- docs/configuration.rst | 10 ++++++++++ docs/gallery-dl.conf | 2 ++ gallery_dl/extractor/misskey.py | 12 +++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index a5f04435..9f2c5220 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -4145,6 +4145,16 @@ Description Your access token, necessary to fetch favorited notes. +extractor.[misskey].date-min & .date-max +---------------------------------------- +Type + |Date|_ +Default + ``null`` +Description + Retrieve only notes posted after/before this |Date|_ + + extractor.[misskey].include --------------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 34ecc115..b120ddac 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -1079,6 +1079,8 @@ "misskey": { "access-token": null, + "date-min" : null, + "date-max" : null, "include" : ["notes"], "renotes" : false, "replies" : true, diff --git a/gallery_dl/extractor/misskey.py b/gallery_dl/extractor/misskey.py index 3e899128..92181948 100644 --- a/gallery_dl/extractor/misskey.py +++ b/gallery_dl/extractor/misskey.py @@ -7,7 +7,7 @@ """Extractors for Misskey instances""" from .common import BaseExtractor, Message, Dispatch -from .. import text, exception +from .. import text, dt, exception from ..cache import memcache @@ -253,6 +253,16 @@ class MisskeyAPI(): data["withRenotes"] = extr.renotes data["withFiles"] = False if extr.config("text-posts") else True + date_min, date_max = extr._get_date_min_max() + if date_min is not None: + data["sinceDate"] = date_min * 1000 + if date_max is None: + # ensure notes are returned in descending order + # TODO: implement 'order-posts' option + data["untilDate"] = (int(dt.to_ts(dt.now())) + 1000) * 1000 + if date_max is not None: + data["untilDate"] = date_max * 1000 + while True: notes = self._call(endpoint, data) if not notes: