0

有没有办法在 python 中使用可读性(文本提取算法)和自定义算法从文本中提取链接?

我想找出一种提取文本正文中链接的方法。

1.) 我在 python https://github.com/gfxmonk/python-readability中使用可读性

2.) 我想以某种方式将提取的文本与原始 html 文本进行比较,以便在文章的实际正文中提取链接。

4

1 回答 1

2

好吧,看起来它返回了一个 BeautifulSoup 树。因此,您应该能够执行以下操作:

article = page.summary()   # Extract article using readability
article.findAll("a")       # Return a list of all links in the article
于 2011-01-04T00:05:32.850 回答