首页 > 其他分享 >爬虫抓取新闻模块提取库推荐newspaper

爬虫抓取新闻模块提取库推荐newspaper

时间:2023-03-17 14:44:50浏览次数:39  
标签:url text 爬虫 抓取 images Article newspaper article

安装

pip3 install newspaper3k

使用

from newspaper import Article

url = 'http://www.example.com/path/to/article'
article = Article(url)
article.download()
article.parse()

text = article.text # 获取新闻正文
images = article.images # 获取新闻图片

标签:url,text,爬虫,抓取,images,Article,newspaper,article
From: https://www.cnblogs.com/pythonywy/p/17226752.html

相关文章