summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2023-02-24 14:43:50 +0000
committerdakkar <dakkar@thenautilus.net>2023-02-24 14:43:50 +0000
commit1dbc7d4baae8f71c28f2db40183a53aa3594840c (patch)
treec3711d47ffab85423a93b6f72c4efbff28910b62
parentFix pagination of Misskey responses (diff)
downloadtweet-archive-1dbc7d4baae8f71c28f2db40183a53aa3594840c.tar.gz
tweet-archive-1dbc7d4baae8f71c28f2db40183a53aa3594840c.tar.bz2
tweet-archive-1dbc7d4baae8f71c28f2db40183a53aa3594840c.zip
fix pagination more (for non-timeline)
-rw-r--r--lib/Dakkar/Misskey.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Dakkar/Misskey.pm b/lib/Dakkar/Misskey.pm
index 484131f..a32bd5b 100644
--- a/lib/Dakkar/Misskey.pm
+++ b/lib/Dakkar/Misskey.pm
@@ -41,8 +41,26 @@ sub _request($self, $endpoint, $payload) {
sub _paged_request($self, $endpoint, $payload, $cb) {
my @all_results;
+ # misskey paged endpoints return results ordered differently
+ # depending on the presence of `sinceId`, `untilId`, `sinceDate`,
+ # `untilDate`
+ #
+ # sinceId untilId sinceDate untilDate order by
+ # x x ? ? id DESC
+ # x ? ? id ASC
+ # x ? ? id DESC
+ # x x createdAt DESC
+ # x createdAt ASC
+ # x createdAt DESC
+ # id DESC
+ #
+ # for simplicity, here we assume we'll never get `untilId`,
+ # `sinceDate`, or `untilDate`, and we page with `sinceId` in
+ # ASCending `id` order
+
my $page_payload = {
limit => 100,
+ sinceId => '0',
$payload->%*,
};