Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/load page issue #176

Open
wants to merge 4 commits into
base: 3.0_master
Choose a base branch
from
Open

Fix/load page issue #176

wants to merge 4 commits into from

Conversation

DaidoujiChen
Copy link
Owner

嘗試修正 #175 的問題
想解決的有兩件事

  • 不想依賴 div 的 class / id 來決定 parse 哪一段 乾脆整個網頁的 <a href 都刮下來用 regex 檢查
  • 過去有些部分會用一個頁面就有最多 40 個圖片來做想像 這次也想拿掉這個限制

我會先試試再改改中
大部分的內容是我跟 windsurf 一起改的 OwOb

Replace div.gt100 selector with a more robust regex pattern to match image URLs.
The new pattern matches URLs in the format: https://e-hentai.org/s/[hash]/[id]-[page]
- Remove static totalPageIndex property
- Add pageSize property that updates dynamically based on actual page size
- Add isEnded property to check if all items are loaded
- Improve page ending detection logic
@@ -275,15 +275,22 @@ + (void)requestImagePagesBy:(HentaiInfo *)info atIndex:(NSInteger)index completi
}
else {
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:data];
NSArray<TFHppleElement *> *pageURLs = [xpathParser searchWithXPathQuery:@"//div [@class='gt100']//a"];
// 使用更通用的 XPath 查詢,查找所有帶有 href 屬性的 a 標籤
NSArray<TFHppleElement *> *pageURLs = [xpathParser searchWithXPathQuery:@"//a[@href]"];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接把整個頁面 <a href 都拆下來

@DaidoujiChen
Copy link
Owner Author

看起來歷史紀錄那邊也會有地方需要調整

@DaidoujiChen
Copy link
Owner Author

圖片多的時候好像會卡 main thread 要再看一下

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.

1 participant