question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

You must `download()` an article first!

See original GitHub issue

I am using newspaper the way it was described in the docs but I kept getting random exception with You must download() an article first!. One example that should be reproducible is:

import newspaper

article = newspaper.Article(url="https://www.digitimes.com/news/a20180328VL202.html")
article.download()
article.parse() # Exception will be thrown here 

Any ideas why?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:14
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
DavidRaynercommented, Jul 5, 2018

This is how I get around this - pretty sure I found this on GH or stackoverflow, can’t remember.

from time import sleep
from newspaper.article import ArticleException, ArticleDownloadState

# Download article
slept = 0
article.download()
while article.download_state == ArticleDownloadState.NOT_STARTED:
    # Raise exception if article download state does not change after 10 seconds
    if slept > 9:
        raise ArticleException('Download never started')
    sleep(1)
    slept += 1

# Parse article
article.parse()
0reactions
MehmetFiratKomurcucommented, Jul 5, 2018

thanks @DavidRayner .When I download too much article(like 100 in a for loop), it gives this exception.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ArticleException: You must `download()` an article first
The error says exactly what's wrong: you must call download() method first before you can access the .maintext property:
Read more >
Art of reading a journal article: Methodically and effectively
Objective: To outline a logical and orderly approach to reading a scientific manuscript. By breaking down the task into smaller, step-by-step components, ...
Read more >
How to get your research published… …and then noticed.
In the first section, we'll look at getting published . The decisions you make about your publications affect their ultimate impact: the journal...
Read more >
Change page size, paper size, or page orientation in ...
To produce a multiple-page publication that contains different individual pages, you must create separate publications for each different paper size, ...
Read more >
Using the 'lsdoctor' Tool (80469)
This means that you must shut down all VCs or PSCs that are in ... To use lsdoctor, you must download the ZIP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found