代码拉取完成,页面将自动刷新
#Description: Scrape and Summarize News Articles
#pip install nltk
#pip install newspaper3k
#Resources: Documenation: https://newspaper.readthedocs.io/en/latest/?source=post_page---------------------------
# Medium Article: https://towardsdatascience.com/scrape-and-summarize-news-articles-in-5-lines-of-python-code-175f0e5c7dfc
# Article Website: https://www.washingtonpost.com/technology/2019/07/17/you-downloaded-faceapp-heres-what-youve-just-done-your-privacy/?noredirect=on&utm_term=.f8b0b55b2805
#Import the libraries
import nltk
from newspaper import Article
#Get the article
url = 'https://www.washingtonpost.com/technology/2019/07/17/you-downloaded-faceapp-heres-what-youve-just-done-your-privacy/?noredirect=on&utm_term=.1938589d078f'
article = Article(url)
# Do some NLP
article.download()
article.parse()
nltk.download('punkt')
article.nlp()
#Get the authors
article.authors
#Get the publish date
article.publish_date
#Get the top image
article.top_image
#Get the article text
print(article.text)
#Get a summary of the article
print(article.summary)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。