[BUG]: Scraper passes headers as query params in requests.get (User-Agent never sent)
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 92/100
Hướng nghiên cứu
Bắt đầu trong backend/app/modules/scraper/extractor.py tại Article_extractor._fetch_html(). Chạy lệnh uv được cung cấp từ thư mục backend/ để quan sát hành vi yêu cầu hiện tại. Công việc được hoàn tất khi User-Agent đã cấu hình được gửi dưới dạng header và các header không còn được tuần tự hóa vào các tham số truy vấn URL.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Description
In backend/app/modules/scraper/extractor.py, Article_extractor._fetch_html() calls:
res = requests.get(self.url, self.headers, timeout=10)
The second positional argument of requests.get(url, params=None, **kwargs) is params, not headers. So:
- The custom
User-Agentheader is never sent. - The headers dict is instead serialized into the URL query string (e.g.
?User-Agent=Mozilla%2F5.0...), producing a malformed request.
_fetch_html() backs extract_with_bs4(), which is the last-resort fallback (it runs only when Trafilatura and Newspaper3k both fail) — so exactly when robust fetching matters most, the request goes out without the intended User-Agent and with a polluted URL.
Steps to Reproduce
Deterministic, no app/keys needed — from the backend/ directory:
uv run python -c "from app.modules.scraper.extractor import Article_extractor; print(Article_extractor('https://httpbin.org/get')._fetch_html())"
Observe the response: the args object contains User-Agent (proving it was sent as a query param), and headers.User-Agent is the default python-requests/... (proving the custom UA was not applied).
Logs and Screenshots
Deterministic, no app/keys needed — from the backend/ directory:
uv run python -c "from app.modules.scraper.extractor import Article_extractor; print(Article_extractor('https://httpbin.org/get')._fetch_html())"
Observe the response: the args object contains User-Agent (proving it was sent as a query param), and headers.User-Agent is the default python-requests/... (proving the custom UA was not applied).
Environment Details
- Present on current
main(commit 70a2af4), independent of OS. - Backend: Python 3.13,
requests>=2.32.3. - Root cause is a universal
requestsAPI behavior, so it reproduces in every environment.
Impact
Medium - Feature works but has issues
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Ngôn ngữ chính
- TypeScript
- Star
- 58
- Fork
- 90
- Merge trung bình
- 11 giờ 51 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AOSSIE-Org/Perspective
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
AOSSIE-Org/Perspective#191 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
AOSSIE-Org/Perspective#190 ·
-
[BUG]: Missing input validation in URlRequest and ChatQuery causes 500 crashes and wasteful scraper executionCó thể đã có người làm @agarwalpranav0711 đã nhận 25 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AOSSIE-Org/Perspective#178 ·
-
[BUG]: chunk_rag_data crashes with ValueError when perspective is a dict, silently dropping RAG vector storageCó thể đã có người làm @agarwalpranav0711 đã nhận 36 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
AOSSIE-Org/Perspective#175 ·
-
docs: frontend/README.md is the default create-next-app boilerplateCó thể đã có người làm @Th-Shivam đã nhận 51 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
AOSSIE-Org/Perspective#159 · 1 bình luận ·
Tất cả issue của AOSSIE-Org/Perspective
Issue tương tự
-
documentation lens:human needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
thebristolsound/birdbrain#2246 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
A voting window past about 69.9 million hours stores a deadline that reads back as no deadlineĐang mởbug ready-for-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
BoardGamesEmpire/board-games-empire-backend#1452 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue stretch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày