python 爬虫newspaper3k 新闻爬去方法 利用第三方库

from newspaper import Article

url = '你想要爬取的网站url' news = Article(url, language='zh')
news .download() #先下载 news .parse() #再解析
print(news.text) #新闻正文 print(news.title) #新闻标题 print(news.html) #未修改的原始HTML print(news.authors) #新闻作者 print(news.top_image) #本文的“最佳图像”的URL print(news.movies) #本文电影url print(news.keywords) #新闻关键词 print(news.summary) #从文章主体txt中生成的摘要
print(news.images) #本文中的所有图像url
原文地址:https://www.cnblogs.com/duanlinxiao/p/9835003.html