[misskey] add 'date-min' & 'date-max' options (#8516)
TODO: implement 'order-posts' option
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1079,6 +1079,8 @@
|
||||
"misskey":
|
||||
{
|
||||
"access-token": null,
|
||||
"date-min" : null,
|
||||
"date-max" : null,
|
||||
"include" : ["notes"],
|
||||
"renotes" : false,
|
||||
"replies" : true,
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user