The search endpoint enables news search with enhanced filtering capabilities in
v3. Key changes include parameter renaming, updated response fields, and new
filtering options.
{"status":"ok","total_hits":521,"page":1,"total_pages":6,"page_size":100,"articles":[{"title":"Tesla lowers range estimates for Model X, S, Y cars","author":"Matt Binder","published_date":"2024-01-05 18:11:03","link":"https://mashable.com/article/tesla-range-estimates","clean_url":"mashable.com",// Domain name, renamed to domain_url in v3"excerpt":"The change follows...",// Brief summary, renamed to description in v3"summary":"Tesla has updated...",// Full text, renamed to content in v3"topic":"tech",// Topic classification, moved to nlp.theme in v3"country":"US","language":"en","authors":"Matt Binder","is_opinion":false,"twitter_account":"@mashable","_score":11.959808,// Renamed to score in v3"_id":"e623cee7239059b40ca40234"// Renamed to id in v3}],"user_input":{"q":"Tesla","search_in":["title_summary_en"],"lang":["en"],"from":"2024-01-01 00:00:00","to":"2024-01-31 00:00:00","ranked_only":"True","sort_by":"relevancy","page":1,"size":100,"not_sources":[],"topic":"tech"// Renamed to theme in v3}}
The latest headlines endpoint provides access to recent news articles. Migration
involves similar parameter updates as the search endpoint, with additional
time-based filtering options.
{"status":"ok","total_hits":10000,"page":1,"total_pages":200,"page_size":50,"articles":[{"title":"Donald Trump Nominates Fox Business Host Sean Duffy","author":"Ted Johnson","published_date":"2024-11-18 23:07:23","published_date_precision":"full","link":"https://deadline.com/2024/11/trump-sean-duffy-1236180738","clean_url":"deadline.com",// Domain name, renamed to domain_url in v3"excerpt":"Donald Trump has gone...",// Brief text, renamed to description in v3"summary":"Sean Duffy in 2018...",// Full text, renamed to content in v3"topic":"business",// Moved to nlp.theme in v3"country":"US","language":"en","authors":"Where Img,Class,Display Inline,Ted Johnson","media":"https://deadline.com/wp-content/uploads/2024/11/img.jpg","is_opinion":false,"twitter_account":"@tedstew","_score":null,// Renamed to score in v3"_id":"75382d1ff5336599bce837ab168bb34b"// Renamed to id in v3}],"user_input":{"lang":["en"],"countries":["US","GB"],"topic":"business",// Renamed to theme in v3"from":"2024-11-11 23:14:24"}}
The sources endpoint in v3 provides enhanced metadata about news sources. Key
changes include the removal of the topic parameter and introduction of new
filtering capabilities.
# Get US news sourcesresult = get_sources(countries="US")# Access source domains (returns list of strings)sources = result["sources"]# e.g., ["example.com", "news.com"]
V3 provides additional parameters for precise source filtering:
params ={"lang":"en","countries":"US","include_additional_info":True,"source_name":"tech,news",# Search within source names"is_news_domain":True,# Filter for news domains only"news_domain_type":"Original Content",# Can be "Original Content" or "Aggregator""from_rank":1,# Filter by rank range"to_rank":1000}
{"message":"Maximum sources displayed according to your plan is set to 1000","sources":[// Simple array of domain strings"wn.com","yahoo.com","headtopics.com"// ...],"user_input":{"lang":["en"],"countries":["US"],"topic":"news"// Replaced by more specific classification in v3}}