Get Latest News By Latitude, Longitude
Get near real time news articles published in local newspapers and other media outlets by specifying a geolocation coordinates (latitude, longitude).
Categories:
This API endpoint is excellent for fetching local and regional news.
Fetch local news using geolocation coordinates (latitude, longitude) as input
Input
import requests
url = "https://specrom-news-api.p.rapidapi.com/"
payload = {
"api_type": "news_by_latitude_longitude",
"lat": "40.730610",
"longitude": "-73.935242"
}
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": "API_key",
"X-RapidAPI-Host": "specrom-news-api.p.rapidapi.com"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
POST / HTTP/1.1
Content-Type: application/json
X-Rapidapi-Key: API_key
X-Rapidapi-Host: specrom-news-api.p.rapidapi.com
Host: specrom-news-api.p.rapidapi.com
Content-Length: 96
{
"api_type": "news_by_latitude_longitude",
"lat": "40.730610",
"longitude": "-73.935242"
}
Parameter | Description |
---|---|
api_type | news_by_latitude_longitude |
lat | Latitude |
longitude | Longitude |
Output
{
"article_list": [
{
source url:"https://www.foxnews.com"
source name:"Fox News"
published_date:"Thu, 06 Apr 2023 20:22:00 GMT"
title:"NYC man pleads guilty to selling fatal dose of fentanyl-laced heroin to actor Michael K. Williams - Fox News"
url_id:"slCdc3TihL57gNfNqq0hoOVXZy6YoUKEpq2whk9bqGcZVkhol9SRfr1pBGSG5OkysZDHwBqs7ZU57OPCzS+btyMS9kR3yqGtMXtalXoa+xYl+aoQyHwxfUbcJRzY75pvpCAdTRX5PsFHk3xbbXHixP2guu5WWRGJHWebSwuICQa56SuV95ZBUD4Xo2xvG+KfFQkNm7xSVuJMcQNUsXp0KLHrYPK0Peyso76PU0W5cldmqX7ncYOGzW5NakzWBV9xa9r7texCX+LgyGqXCru9faxXqDuibTeM3lSPoZDow8vnfk3/qibj88q+iJEhXB2ISbPEP2XttnJyrpAlSfwKIcfAtuvuLB8MPgmypVS9sXqie99sWmW8n44y7pyRCYl2rS2DwpFzQL5Fh+RwoQjeAzBfAU33udpCY+D60uEa70+4/50i/TVLgqTUmrzAqZOuNtjoEwhdwlxltBA0Wb9cT6jQfOtRweefGA==*9PU3DmkN3DblUuPpApib0g==*6b/1vdOgFWV3Qt3IwCRG5g==*mMg42UOs9Pfh1f8vjQq0Ig=="
},
.
.
.
(Output Truncated)
}
]
}
Parameter | Description |
---|---|
article_list | A list of dictionaries containing individual news articles |
source url | web domain of the media outlet |
source name | name of the media outlet |
publishedAt | date of the news article |
title | title of the news article |
url_id | unique url_id of the news article. Use our separate endpoint called fetch news article by url_id to fetch complete details such as full_text, author, url etc. of the news article |