Skip to content

fix: Handle encoding errors in selectolax by switching to BeautifulSoup#569

Merged
drunkpig merged 3 commits intoccprocessor:devfrom
ideaflow:dev
Oct 15, 2025
Merged

fix: Handle encoding errors in selectolax by switching to BeautifulSoup#569
drunkpig merged 3 commits intoccprocessor:devfrom
ideaflow:dev

Conversation

@ideaflow
Copy link
Collaborator

selectolax 会默认将网页字符串视为'utf-8'编码,如果不是这个编码会报错,而BeautifulSoup可以更自动地处理编码问题,所以如果修复html的步骤遇到编码错误,则替换为BeautifulSoup

@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #569      +/-   ##
==========================================
+ Coverage   90.97%   91.04%   +0.06%     
==========================================
  Files         102      106       +4     
  Lines        8890     9333     +443     
==========================================
+ Hits         8088     8497     +409     
- Misses        802      836      +34     
Files with missing lines Coverage Δ
...it/main_html_parser/simplify_html/simplify_html.py 83.47% <100.00%> (+0.45%) ⬆️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@drunkpig drunkpig left a comment

Choose a reason for hiding this comment

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

bs4在效率上比lxml低10倍。建议采用try...except fallback的形式,在捕获到exception之后再采用bs4兜底

@drunkpig drunkpig merged commit d32c9af into ccprocessor:dev Oct 15, 2025
4 checks passed
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.

2 participants