python
pip install newspaper3k
python
from newspaper import Article, Config
python
config = Config()
config.browser_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
config.request_timeout = 10
python
url = 'https://example.com/news-article'
article = Article(url, config=config)
article.download()
article.parse()
python
summary = article.summary
print(summary)
python
from newspaper import Article, Config
config = Config()
config.browser_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
config.request_timeout = 10
url = 'https://example.com/news-article'
article = Article(url, config=config)
article.download()
article.parse()
summary = article.summary
print(summary)