Fetch Parsed News Article By url_id
A Specrom News API endpoint for fetching the full_text, title, author, main image etc. from the news article using url_id as input.
Categories:
This is a simple API endpoint that will take in a url_id (generated by our other endpoints) of any news article and return parsed data containing full_text, title, author, main image.
Fetch the full_text, title, author, main image etc. from the news article using url_id as input.
Input
import requests
url = "https://specrom-news-api.p.rapidapi.com/"
payload = {
"api_type": "fetch_parsed_news_article_by_id",
"url_id": "2+W9MSIWD4PJ5kF6fcRThhpsnzW92j46dBr8UEiHBKwSjaiOKBMnTWcmr5BXqe0vwpgP9bpT8r6Fgc8MnaYXYyidz9gl7WjxTCFUpKW/scAuJegSL86lw4C+M4Ea9/rPgFkTu1MkA34cs5/QXMTMH6J9xG18dcQG4sbe6a2pV1mY6jzCudZauazA13CO+NVFJH/R7UBIsT42lm2RPY4ISlPHuSh6y5AjrUiCwx4=*o3X7JdWv94Q2Td9x31pIFA==*fRxtKu8HwfTNo++zlEVHnA==*DXgO4zPEi1nWqrKZwosVwA=="
}
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: 381
{
"api_type": "fetch_parsed_news_article_by_id",
"url_id": "2+W9MSIWD4PJ5kF6fcRThhpsnzW92j46dBr8UEiHBKwSjaiOKBMnTWcmr5BXqe0vwpgP9bpT8r6Fgc8MnaYXYyidz9gl7WjxTCFUpKW/scAuJegSL86lw4C+M4Ea9/rPgFkTu1MkA34cs5/QXMTMH6J9xG18dcQG4sbe6a2pV1mY6jzCudZauazA13CO+NVFJH/R7UBIsT42lm2RPY4ISlPHuSh6y5AjrUiCwx4=*o3X7JdWv94Q2Td9x31pIFA==*fRxtKu8HwfTNo++zlEVHnA==*DXgO4zPEi1nWqrKZwosVwA=="
}
Parameter | Description |
---|---|
api_type | fetch_parsed_news_article_by_id |
url_id | url_id of the news article. This is generated by our other endpoints. |
Output
{"author":["Perry Stein","Shayna Jacobs"],
"content":"Former president Donald Trump on Tuesday pleaded not guilty to 34 counts stemming from 2016 hush-money payments," ....(output truncated),
"meta_description":"When will he appear in court next? What is the discovery process? Your questions and more answered.",
"og_title":"What’s next for Trump after pleading not guilty to 34 felony counts","
publishedAt":"2023-04-05",
"source_url":"washingtonpost.com",
"title":"What’s next for Trump after pleading not guilty to 34 felony counts",
"url":"https://www.washingtonpost.com/nation/2023/04/05/trump-indictment-whats-next/",
"urlToImage":"https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/BSK27QJRAJAVHDMPKYPSIUYUWM.jpg&w=1440"}
Parameter | Description |
---|---|
author | A list of authors of the news article |
content | full_text of the news article |
meta_description | text from the meta_description tag on the page |
og_title | text from the og_title tag on the page |
publishedAt | date of the news article |
source_url | source domain of the news article |
title | title of the news article |
url | canonical url of the news article |
urlToImage | primary image URL from the news article |