From a759bc617e2fb3a3efb763318378a8ed79735e11 Mon Sep 17 00:00:00 2001 From: yitzhaq <17812841+yitzhaq@users.noreply.github.com> Date: Thu, 9 Jul 2026 14:34:39 +0200 Subject: [PATCH] Add page/per_page to watched and collection sync interfaces Trakt now paginates the /sync/watched and /sync/collection endpoints (https://github.com/trakt/trakt-api/discussions/775), returning only the first 100 items when no paging is requested. Unlike the ratings, history and watchlist interfaces, watched and collection had no way to pass page/limit, so callers could not fetch beyond the first page. Add page/per_page (mirroring the existing interfaces) and forward them as query parameters. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/trakt/interfaces/sync/collection.py | 8 +++++++- lib/trakt/interfaces/sync/watched.py | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/trakt/interfaces/sync/collection.py b/lib/trakt/interfaces/sync/collection.py index 6a62643..bd707b1 100644 --- a/lib/trakt/interfaces/sync/collection.py +++ b/lib/trakt/interfaces/sync/collection.py @@ -7,7 +7,7 @@ class SyncCollectionInterface(Get, Add, Remove): path = 'sync/collection' flags = {'is_collected': True} - def get(self, media=None, store=None, params=None, extended=None, **kwargs): + def get(self, media=None, store=None, params=None, extended=None, page=None, per_page=None, **kwargs): if media is None: raise ValueError('Invalid value provided for the "media" parameter') @@ -17,6 +17,12 @@ def get(self, media=None, store=None, params=None, extended=None, **kwargs): if extended: query['extended'] = extended + if page is not None: + query['page'] = page + + if per_page is not None: + query['limit'] = per_page + # Request collection return super(SyncCollectionInterface, self).get( media, store, diff --git a/lib/trakt/interfaces/sync/watched.py b/lib/trakt/interfaces/sync/watched.py index 3d193ae..8aabe56 100644 --- a/lib/trakt/interfaces/sync/watched.py +++ b/lib/trakt/interfaces/sync/watched.py @@ -7,13 +7,15 @@ class SyncWatchedInterface(Get): path = 'sync/watched' flags = {'is_watched': True} - def get(self, media=None, store=None, params=None, extended=None, **kwargs): + def get(self, media=None, store=None, params=None, extended=None, page=None, per_page=None, **kwargs): if media is None: raise ValueError('Invalid value provided for the "media" parameter') # Build query query = { - 'extended': extended + 'extended': extended, + 'page': page, + 'limit': per_page } # Request watched