Skip to content

Commit d067c3c

Browse files
committed
fix: More generic fix for failed bs4 parsing
1 parent 916df52 commit d067c3c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

har2tree/helper.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,13 @@ def find_external_ressources(mimetype: str, data: bytes, base_url: str, all_requ
385385
else:
386386
external_ressources['css'].append(url)
387387
else:
388-
soup = make_soup(data)
389-
string_soup = str(soup)
388+
try:
389+
soup = make_soup(data)
390+
string_soup = str(soup)
391+
except Exception as e:
392+
logger.warning(f'Unable to parse HTML blob: {e}')
393+
string_soup = ''
394+
390395
if not string_soup:
391396
# Empty HTML document, nothing to do
392397
return external_ressources, embedded_ressources

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "har2tree"
3-
version = "1.31.1"
3+
version = "1.31.2"
44
description = "HTTP Archive (HAR) to ETE Toolkit generator"
55
authors = [
66
{name="Raphaël Vinot", email="[email protected]"}

0 commit comments

Comments
 (0)