commit 623e8e0ed2f2a52fca8add5330ce66b6bb3246a6
parent aa262308b4fa70afcd4550f4bb8a1ff7c232790b
Author: Alex Balgavy <alex@balgavy.eu>
Date: Fri, 12 May 2023 16:08:07 +0200
libpocket.rb: add method to archive 'pocketbook' tag
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/scripts/libpocket.rb b/scripts/libpocket.rb
@@ -85,6 +85,14 @@ class Pocket
end
end
+ def archive_all_pocketbook
+ tagged_pocketbook = api_call('/get', { tag: 'pocketbook', state: :any })
+ ids = tagged_pocketbook['list'].map(&:first)
+ actions = ids.map { |id| [{action: :tags_remove, item_id: id, tags: 'pocketbook'}, {action: :archive, item_id: id}]}.flatten
+ result = api_call('/send', { actions: })
+ warn "Some errors, ids #{ids}" unless result['action_results'].all?
+ end
+
def save(url)
api_call("/add", url: url)
end