Classify News Articles Using Smart Labels

A Specrom News API endpoint for labeling common types of articles seen on news websites

News domains these days have tons of different content besides news itself that help them monetize their website either by pushing pay per click ads, or through use of affiliate links. The smart labels classifier will help you identify such content.

Fetch the full_text, title, author, main image etc. from the news article using url_id as input.

Almost all news domains including major outlets such as New York Times publish lots of articles that are not hard news, but rather clickbaits.

Use our smart labels to identify and filter out such news articles by using headline and meta_description text as input. The labels are below:

  • Non-News: This category includes articles that are often referred to as “soft news.” Unlike traditional news articles that report on a specific event or breaking news, non-news articles focus on evergreen topics that are not time-sensitive. Examples of non-news articles include how-to guides, tips, reviews, and general profiles. These articles may be more feature-like in nature, and can often be enjoyed by readers at any time.

  • Opinion: This category includes articles that express a strong point of view, such as editorials, opinion pieces, letters to the editor, or other content that may be subjective in nature.

  • Paid News: This category includes articles that are sponsored or paid for by a brand or advertiser, often in the form of advertorials. The goal of these articles is typically to promote a product, service, or brand.

  • Pop Culture: This category covers articles related to entertainment and popular culture, such as stories about celebrities, movies, TV shows, music, fashion, and other trends.

  • Fact Check: This category includes articles that seek to verify the validity of rumors or questionable claims, with the goal of combating misinformation. Fact-checking articles typically provide evidence-based information and sources to support their claims.

  • Roundup: This category includes articles that summarize multiple stories or provide a collection of concepts, takeaways, data analysis, or lists. Roundup articles can be useful for readers who want to quickly get up-to-speed on a particular topic or trend.

  • Press Release: This category includes official statements or announcements, typically published by wire services and authored by organizations or PR professionals. Press releases may cover a variety of topics, such as new products, partnerships, or other news related to the organization.

  • News: This category includes traditional news articles that report on a specific event or breaking news. These articles are typically objective in nature and report on facts related to the event or news story.

Input

import requests

url = "https://specrom-news-api.p.rapidapi.com/"

payload = {
  "api_type": "smart_labels",
  "input_text": "Top 20 Berkshire Hathaway holdings: What's in Warren Buffett portfolio going into 2023?"
}
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": "smart_labels",
    "input_text": "Top 20 Berkshire Hathaway holdings: What's in Warren Buffett portfolio going into 2023?"
}
	
	
Parameter Description
api_type smart_labels
input_text input text (generally the headline plus the text in meta_description tag)

Output


{"Topic":"Non-news"}
Parameter Description
Topic The predicted topic of the news article