Skip to content

fix: watch-later returns empty items despite count > 0 - #22

Open
zwczwczwc wants to merge 1 commit into
public-clis:mainfrom
zwczwczwc:fix/watch-later-empty-list
Open

fix: watch-later returns empty items despite count > 0#22
zwczwczwc wants to merge 1 commit into
public-clis:mainfrom
zwczwczwc:fix/watch-later-empty-list

Conversation

@zwczwczwc

Copy link
Copy Markdown

Summary

  • Fix bili watch-later returning count > 0 but empty items list
  • Root cause: the command used homepage.get_favorite_list_and_toview() which calls the navigation sidebar API (x/v3/fav/folder/list4navigate) — this API only returns counts for the sidebar badge, not video lists
  • Switched to the dedicated toview API user.get_toview_list() which calls x/v2/history/toview and returns the full video list
  • Added aidbvid conversion in normalize_watch_later_item since the toview API returns aid not bvid

Changes

  1. bili_cli/client.py: Replace get_toview implementation to use user.get_toview_list() instead of homepage.get_favorite_list_and_toview()
  2. bili_cli/payloads.py: Update normalize_watch_later_item to convert aid to bvid for consistent output
  3. tests/test_client.py: Update tests to mock the new API call
  4. Removed unused homepage import

Test plan

  • 201 existing tests pass, no regressions
  • ruff lint passes
  • Manual test: bili watch-later --yaml now returns 253 items with proper bvid/author/duration
  • bili favorites, bili history, bili video --subtitle, bili search all still work

🤖 Generated with Claude Code

`get_toview()` was calling `homepage.get_favorite_list_and_toview()`
(API x/v3/fav/folder/list4navigate), which only populates the `list`
field with favorite folders — the `list` for "稍后再看" (watch-later)
is always null from this navigation sidebar endpoint.

Switch to the dedicated `user.get_toview_list()` (API x/v2/history/toview),
which returns actual watch-later video entries with aid/owner/duration.

Also add aid→bvid conversion in `normalize_watch_later_item()` since
the toview API returns aid instead of bvid, and include `aid` in the
normalised output for completeness.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants