Closed ihorbond closed 6 years ago
@ihorbond Thanks for pointing this out. The example usage of the v2.topHeadlines
is misleading in that it demonstrates that sources
, country
, and category
are available parameters to pass, but according to the official NewsAPI top-headlines docs, country
and category
can not be used simultaneously with sources
.
I would guess that the reason you got no articles back after removing sources
is that there simply were no recent top headlines that were categorized as "business" and contained the query "bitcoin".
I will update my usage examples to address this. I recommend to always refer to the official NewsAPI docs when looking for which parameters are valid and what kind of values they accept.
Examples updated. Closing issue.
@bzarras Hi, the problem still appear, I mean for instance top_headlines = newsapi.get_top_headlines(q='bitcoin', sources='bbc-news,the-verge', category='business', language='en', country='us') still doesn't work due to the error message (cannot mix country/category param with sources param. )
I don't know why the object doesn't have the category of the news!! very weird api
@ihorbond Thanks for pointing this out. The example usage of the
v2.topHeadlines
is misleading in that it demonstrates thatsources
,country
, andcategory
are available parameters to pass, but according to the official NewsAPI top-headlines docs,country
andcategory
can not be used simultaneously withsources
.I would guess that the reason you got no articles back after removing
sources
is that there simply were no recent top headlines that were categorized as "business" and contained the query "bitcoin".I will update my usage examples to address this. I recommend to always refer to the official NewsAPI docs when looking for which parameters are valid and what kind of values they accept.
ThankYou
Can you please update the document, so that no new developer finds these issues again? It will be really helpful.
Thank You
After removing source from the code I am getting the results
Tried to get news with the following example from official website
but keep getting error 'You cannot mix the sources parameter with the country or category parameters'. When I remove sources I don't get any articles back. node version 9.11. running on local express server