Alir3z4 / Alir3z4/html2text

AssertionError for img src attribute

Đang mở
#334 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
2.2k
Fork
296
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Some web pages have errors. Rather than simply throwing an exception, it would be better to ignore benign errors and convert as much of the page as possible.

- Version by `html2text --version`: 2020.1.16
- Python version `python --version`: Python 3.7.7

- Test script:
```
import requests
import html2text

rsp = requests.get('https://blog.logrocket.com/from-rest-to-graphql/')
h2t = html2text.HTML2Text()
h2t.ignore_links = True
h2t.bypass_tables = False
text = h2t.handle(rsp.text)
```

- Log:
```
File "c:\users\arvindpdmn\miniconda3\lib\site-packages\html2text\__init__.py", line 142, in handle
self.feed(data)
File "c:\users\arvindpdmn\miniconda3\lib\site-packages\html2text\__init__.py", line 139, in feed
super().feed(data)
File "c:\users\arvindpdmn\miniconda3\lib\html\parser.py", line 111, in feed
self.goahead(0)
File "c:\users\arvindpdmn\miniconda3\lib\html\parser.py", line 171, in goahead
k = self.parse_starttag(i)
File "c:\users\arvindpdmn\miniconda3\lib\html\parser.py", line 345, in parse_starttag
self.handle_starttag(tag, attrs)
File "c:\users\arvindpdmn\miniconda3\lib\site-packages\html2text\__init__.py", line 191, in handle_starttag
self.handle_tag(tag, dict(attrs), start=True)
File "c:\users\arvindpdmn\miniconda3\lib\site-packages\html2text\__init__.py", line 502, in handle_tag
assert attrs["src"] is not None
AssertionError
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

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.