Skip to content

fix(weread/book): add fallback selectors for reader page without cover#1138

Merged
jackwener merged 3 commits intojackwener:mainfrom
lw-yang:fix/weread-book-selector-fallback
Apr 22, 2026
Merged

fix(weread/book): add fallback selectors for reader page without cover#1138
jackwener merged 3 commits intojackwener:mainfrom
lw-yang:fix/weread-book-selector-fallback

Conversation

@lw-yang
Copy link
Copy Markdown
Contributor

@lw-yang lw-yang commented Apr 22, 2026

Summary

  • When the private API session expires, loadReaderFallbackResult navigates to the reader URL. The page now sometimes skips the cover/flyleaf and renders reading content directly, causing page.wait for .horizontalReaderCoverPage_content_bookTitle / .wr_flyleaf_page_bookInfo_bookTitle to time out.
  • Add .readerTopBar_title_link to the wait selector (always present in the top bar)
  • Use cascading firstText() for title/author extraction: cover → flyleaf → outline panel → top bar → document.title parsing

Test plan

  • opencli weread book 31732574 — previously crashed with SELECTOR error, now returns title + author
  • Verify with a logged-in session that cover/flyleaf path still works (full metadata returned)

Fixes #1137

🤖 Generated with Claude Code

lw-yang and others added 3 commits April 22, 2026 10:28
When the private API session expires, `loadReaderFallbackResult` navigates
to the reader URL. The page now sometimes skips the cover/flyleaf and
renders reading content directly, causing the wait for cover/flyleaf title
selectors to time out.

- Add `.readerTopBar_title_link` to `page.wait` selector (always present)
- Use cascading `firstText()` for title: cover → flyleaf → outline → top bar
- Use cascading `firstText()` for author: cover → flyleaf → outline → document.title

Fixes jackwener#1137

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jackwener jackwener merged commit 69d3a73 into jackwener:main Apr 22, 2026
18 of 19 checks passed
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.

[autofix] weread/book: SELECTOR

2 participants