Marcus AU
Marcus AU

Reputation: 59

Why the python module newspaper3k only return 0 articles for tencent, sina and wallstreetcn?

The newspaper3k library is amazing. I am addicted on it.

May I ask, why the Source and build() only return 0 articles from most of the china financial news page?

Any problem in my code?

from newspaper import Article, Source

url='https://wallstreetcn.com/live/global'

result=newspaper.Source(url,language='zh')

result.build()

result.size()

0

Upvotes: 2

Views: 631

Answers (1)

Ami Hollander
Ami Hollander

Reputation: 2535

I run your code and received a different result, maybe you run into cache problem. try to add memoize_articles=False, see:

import newspaper

url='https://wallstreetcn.com/live/global'
result = newspaper.Source(url, language='zh', memoize_articles=False)

result.build()
result.size()
>>> 2

you can find the documentation here

Upvotes: 1

Related Questions