Fetch Parsed News Article By URL
A Specrom News API endpoint for fetching the full_text, title, author, main image etc. from the news article using URL as input.
Categories:
This is a simple API endpoint that will take in a URL 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 as input.
Input
import requests
url = "https://specrom-news-api.p.rapidapi.com/"
payload = {
"api_type": "fetch_parsed_news_article_by_url",
"url": "https://edition.cnn.com/2020/06/30/tech/facebook-ad-business-boycott/index.html"
}
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: 151
{
"api_type": "fetch_parsed_news_article_by_url",
"url": "https://edition.cnn.com/2020/06/30/tech/facebook-ad-business-boycott/index.html"
}
Parameter | Description |
---|---|
api_type | fetch_parsed_news_article_by_url |
url | URL of the news article |
Output
{
"author": [
"Rishi Iyengar"
],
"content": "San Francisco CNN Business —\n\nEach day, more household names join the list of brands suspending advertising on Facebook to protest what they say are the social network’s failures to stop the spread of hate. On Monday alone, Adidas (ADDDF), HP (HPQ), and Ford (F) added their names to a list that already had Unilever (UL), The North Face, Coca Cola (CCHGY), Honda (HMC) and many others.\n\n"........(output truncated),
"meta_description": "Each day, more household names join the list of brands suspending advertising on Facebook to protest what they say are the social network's failures to stop the spread of hate. On Monday alone, Adidas, HP, and Ford added their names to a list that already had Unilever, The North Face, Coca Cola, Honda and many others.",
"og_title": "Here's how big Facebook's ad business really is | CNN Business",
"publishedAt": "2020-06-30",
"source_url": "cnn.com",
"title": "Here’s how big Facebook’s ad business really is",
"url": "https://www.cnn.com/2020/06/30/tech/facebook-ad-business-boycott/index.html",
"urlToImage": "https://media.cnn.com/api/v1/images/stellar/prod/200630015227-facebook-ads-stock.jpg?q=x_3,y_243,h_1684,w_2993,c_crop/w_800"
}
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 |