pythonpython-2.7python-newspaper

"No module named tldextract"


I tried the following code in python:

from newspaper import Article

#A new article from BBC
url = "http://www.bbc.com/news/magazine-26935867"

#For different language newspaper refer above table
BBC_article = Article(url, language="en") # en for English

And I am getting following errors:

Traceback (most recent call last): File "news_paper_article.py", line 3, in from newspaper import Article

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/init.py", line 10, in from .article import Article, ArticleException

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/article.py", line 12, in from . import images File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/images.py", line 21, in from . import urls

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/urls.py", line 16, in from tldextract import tldextract ImportError: No module named tldextract

It may be simple issues but I am just starting, any help is appreciated.


Solution

  • Try with:

    pip install tldextract