ContentTypeFilter rejects every URL that carries a query string or fragment

Đang mở
#2,554 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@HhH666-ux đang làm issue này rồi.

Từ ngày 13/11/2026.

  • #2555 của @HhH666-ux — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

Start with ContentTypeFilter._extract_extension in crawl4ai/deep_crawling/filters.py, and compare it with how URLPatternFilter uses urlparse(url).path. Strip the fragment and query before splitting the extension, then check that page.html?v=2 and page.html#section report html while extensionless URLs stay allowed. Done means regression tests cover these cases. Open PR #2555 already targets this, so coordinate with it before starting.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

ContentTypeFilter._extract_extension() reads the extension from the raw URL, so a query string or fragment becomes part of it:

from crawl4ai.deep_crawling.filters import ContentTypeFilter

f = ContentTypeFilter(allowed_types=["text/html"])
f.apply("https://example.com/page.html")            # True
f.apply("https://example.com/page.html?v=2")        # False  (extension parsed as "html?v=2")
f.apply("https://example.com/page.html#section")    # False

Any allowed HTML page reachable only through a query string (pagination, ?utm_* links, anchors) is therefore filtered out during deep crawling. URLPatternFilter already parses urlparse(url).path, so this looks like a miss in _extract_extension rather than intended behaviour.

Expected behaviour

Strip #... and ?... before splitting the path, so page.html?v=2 reports html. URLs without an extension should stay allowed, as they are today. I will open a small PR with regression tests.

Ngôn ngữ chính
Python
Star
87.2k
Fork
9.1k
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của unclecode/crawl4ai

Tất cả issue của unclecode/crawl4ai

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.