codelucas / codelucas/newspaper

Set timeout for download_articles

Open
#293 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
15.2k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Hi I am wondering what is the safest method to set a time limit for function download_articles, for example, in the following code,

paper = newspaper.build('cnn.com')
paper.download_articles(timeout=10) # for illustration

or like "http://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish", using

with timeout(seconds=100):
  paper.download_articles()

And if I set the timeout following method this way, will the undownloaded url be downloaded next time (after rebuilding the paper)?

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the download_articles function and reading how article downloads and undownloaded URLs are tracked. Check the existing download-related behavior before deciding where a timeout belongs. Done means the timeout behavior and whether missed URLs are retried after rebuilding are defined and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.