Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

I'm attempting to make a web parser and spared it. I had discovered a paper library. I'm utilizing Eclipse. In any case, I was unable to get a good outcome. Can anyone please help me. 

import newspaper

cnn_paper = newspaper.build('http://cnn.com')

for article in cnn_paper.articles:

    print(article.url)

I'm getting this error message

Traceback (most recent call last):

  File "D:\workspace2\JesElaSearchSys\NespaperScraper_01.py", line 2, in <module>

    import newspaper

  File "C:\Python27\lib\site-packages\newspaper3k-0.1.5-py2.7.egg\newspaper\__init__.py", line 10, i

n <module>

    from .article import Article, ArticleException

  File "C:\Python27\lib\site-packages\newspaper3k-0.1.5-py2.7.egg\newspaper\article.py", line 12, in

 <module>

    from . import images

  File "C:\Python27\lib\site-packages\newspaper3k-0.1.5-py2.7.egg\newspaper\images.py", line 15, in 

<module>

    import urllib.request

ImportError: No module named request

1 Answer

0 votes
by (26.4k points)

In your code, there's nothing wrong. You just need to download or locate request and newspaper libraries. It appears newspaper/request library is absent on your improvement machine.

$ pip install newspaper

$ pip install urllib3

I think, the above command will help you for installing.

Want to learn python in detail? Join python course fast!

Related questions

0 votes
1 answer
0 votes
1 answer
asked May 15, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked May 15, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Jul 13, 2020 in Python by ashely (50.2k points)

Browse Categories

...