feat: paginate Strava following feed for 50β100 activities#34
Merged
Conversation
Previously only a single page (~13β16 entries) was fetched, because the
JSON-XHR rewrite dropped the quantity control that the old HTML parser had
and never consumed pagination.hasMore.
Strava's /dashboard/feed endpoint uses cursor pagination (verified via HAR):
each entry carries cursorData.updated_at / rank; the next page is requested
with before=updated_at and cursor=int(rank) of the last entry. The loop runs
while hasMore is true, up to _FEED_MAX_PAGES=6 pages or 100 unique activities.
A short random pause (0.5β1.5 s, sleep/rng injectable for tests) is inserted
between page requests to keep load human-like.
Callers (engine.py, routes.py) and FeedParser.parse() are unchanged: the merged
result is returned as a single {"entries": [...], "pagination": {...}} dict.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
1bcfb83) dropped the quantity control of the old HTML parser and never readpagination.hasMore./dashboard/feedendpoint uses cursor-based pagination (verified via HAR capture, 2026-07-01). Each response entry carriescursorData: {updated_at, rank}; the next page is fetched withbefore=updated_atandcursor=int(rank)of the last entry.hasMoreis true, up to_FEED_MAX_PAGES = 6pages or_FEED_TARGET_ACTIVITIES = 100unique activities.engine.pyandroutes.pyare untouched;FeedParser.parse()receives the same single-dict interface (merged pages stitched into one{"entries": [...], "pagination": {...}}).Test plan
hasMore=false(exact 1 request)_FEED_MAX_PAGEScap (6 requests max even ifhasMorestays true)feed_type+athlete_id)before/cursorfrom previous page's last entrycursorDatais missing despitehasMore=truen_pages β 1timesπ€ Generated with Claude Code