unclecode / unclecode/crawl4ai
[Bug]: Disallow: /*? in robots.txt blocks the whole website.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 83.9k
- Forks
- 8.7k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 11
Description
crawl4ai version
0.9.0
Expected Behavior
The rule in robots.txt disallows scraping urls with query params, the rest of the page works as expected.
Current Behavior
crawl4ai 0.9.x patches the stdlib urllib.robotparser to support wildcards, but it still matches rules against normalized paths (paths where the query string has already been stripped). Ecommerce sites commonly ship (this is advised by multiple SEO blogs online):
Disallow: /*?
The intent is to block only URLs carrying a query string, e.g. /?s=search. After normalization the ? is gone, so the rule collapses to Disallow: /* and the entire site reads as disallowed.
Is this reproducible?
Yes
Inputs Causing the Bug
- Disallow: /*? in robots.txt
When check_robots_txt=True
Steps to Reproduce
- Scrape any website (check_robots_txt=True) with Disallow: /*? in robots.txt (test webserver is sufficient in this case)
Code snippets
OS
macOS
Python version
3.9.10
Browser
Chrome
Browser version
No response
Error logs & Screenshots (if applicable)
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with a test webserver and check_robots_txt=True, using a robots.txt rule of Disallow: /*?. Inspect the robots handling around the patched urllib.robotparser behavior. Done means URLs with query strings are disallowed while the corresponding paths without query strings remain allowed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100