我知道类似html2text、BeautifulSoup等工具,但问题在于它们也会提取JavaScript并将其添加到文本中,使得难以分离。
htmlDom = BeautifulSoup(webPage)
htmlDom.findAll(text=True)
交替地,
from stripogram import html2text
extract = html2text(webPage)
这两种方法都会提取页面上的所有JavaScript代码,这是不必要的。
我只想提取可读文本,可以从浏览器复制。