Closed ken1009us closed 1 year ago
@ken1009us , please use the latest package 0.2.7 that was published this morning. It should address the error invalid language
and allow you to proceed.
Thank you for your reply.
I have already installed the latest package 0.2.7 but I think I still got the same issue.
I need to go to the site-packages.newsapi.newsapi_client.py
to replace the language="en"
with language="en-US"
. This action can let me grab the data for api.get_top_headlines()
, api.get_top_headlines(country="us")
and api.get_top_headlines("uk")
.
However, it didn't fix the error regarding using other given parameters. For example, if I change the country
to other values. I still got 0 results.
Also, google-news is the only resource
for the received article
. There are no other resources if I used api.get_top_headlines()
.
$ pip freeze | grep newsapi
newsapi-python==0.2.7
(base)
Please see reply here: https://github.com/mattlisiv/newsapi-python/issues/75#issuecomment-1451856918
The scarce results are an issue you will need address with the NewsAPI team.
Describe the bug
When I used only
sources
for the given parameter, I was able to retrieve the data. However, if I usedq
andcountry
or other parameters, I received 0 results. For example:This works:
But this doesn't work:
I also tried:
but got this error:
I replaced the
en
innewsapi.const.language
withen-US
and I can receive the data right now but the source of the data is only google-news.Also, if I used other countries, for example:
I received 0 results.