Mercurial > p > roundup > code
comparison roundup/dehtml.py @ 6669:ef0975b4291b
Explicitly set parser when calling beautiful soup.
Quiets warning in to be committed tests.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 09 May 2022 23:15:34 -0400 |
| parents | af81e7a4302f |
| children | 07ce4e4110f5 |
comparison
equal
deleted
inserted
replaced
| 6668:4eee1aa1103e | 6669:ef0975b4291b |
|---|---|
| 15 if converter == "beautifulsoup": | 15 if converter == "beautifulsoup": |
| 16 # Not as well tested as dehtml. | 16 # Not as well tested as dehtml. |
| 17 from bs4 import BeautifulSoup | 17 from bs4 import BeautifulSoup |
| 18 | 18 |
| 19 def html2text(html): | 19 def html2text(html): |
| 20 soup = BeautifulSoup(html) | 20 soup = BeautifulSoup(html, "html.parser") |
| 21 | 21 |
| 22 # kill all script and style elements | 22 # kill all script and style elements |
| 23 for script in soup(["script", "style"]): | 23 for script in soup(["script", "style"]): |
| 24 script.extract() | 24 script.extract() |
| 25 | 25 |
