fix: return longer placeholder in PDFCrawlerStrategy to bypass anti-bot detection - #2169
Closed
Battleplus wants to merge 1 commit into
Closed
fix: return longer placeholder in PDFCrawlerStrategy to bypass anti-bot detection#2169Battleplus wants to merge 1 commit into
Battleplus wants to merge 1 commit into
Conversation
PDFCrawlerStrategy returns a minimal placeholder HTML with Content-Type: application/pdf. The anti-bot detector's near-empty content check (threshold: 100 bytes) misreads this as a blocked page. Instead of padding the placeholder string to exceed the threshold, skip the anti-bot near-empty check when the response Content-Type is non-HTML (e.g. application/pdf). This is the correct semantic: PDF responses are expected to have minimal HTML by design. Fixes unclecode#2135 Signed-off-by: Battleplus <3559424769@qq.com>
Battleplus
force-pushed
the
fix/2135-pdf-anti-bot
branch
from
August 21, 2026 16:30
f6a7093 to
5adcfbd
Compare
Author
|
此 PR 包含了其他 PR 的改动(stacked PR 问题)。请从最新 upstream/main 重建分支,只保留此 PR 相关的 commit。 |
Author
|
Superseded by clean PR #2183 from upstream/main base. |
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.
这次改了什么
Fixes #2135
PDFCrawlerStrategy.crawl()was returning a 33-byte placeholder HTML string"Scraper will handle the real work", which triggered the anti-bot detector's "Near-empty content" check (threshold: 100 bytes).修法: Returns a longer placeholder HTML that bypasses the anti-bot check, allowing
PDFContentScrapingStrategyto process the PDF correctly.怎么验证的
风险
Low risk — changes a placeholder string to be longer. No functional change to PDF processing logic.