news API Python Client

Extract news data with our news API Python client. Get programmatic access to engagement scores and metadata, structured JSON/CSV/XML output formats, 500 articles per minute extraction speed, 25 categories, real-time news data from 1000+ sources, and more using simple Python code. Start free, no credit card required.

Trusted by industry leaders all over the world

Integrate our news API

The Apify API client for Python is the official library that allows you to use news API in Python, providing convenience functions and automatic retries on errors. Get started with simple pip installation and robust error handling built-in.

Python

Python

JavaScript

JavaScript

HTTP

HTTP

MCP

MCP

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "dateRange": "today",
10 "maxArticles": 1000,
11 "proxyConfiguration": { "useApifyProxy": False },
12}
13
14# Run the Actor and wait for it to finish
15run = client.actor("glitch_404/ultimate-news-scraper").call(run_input=run_input)
16
17# Fetch and print Actor results from the run's dataset (if there are any)
18print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
19for item in client.dataset(run["defaultDatasetId"]).iterate_items():
20 print(item)
21
22# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

Get data with news API Python client

Use our Python API client to extract comprehensive news data by providing category preferences, date ranges, and maximum article counts. The API returns structured data, including titles, summaries, publishers, authors, categories, publication dates, engagement scores, article bodies, images, and URLs from over 1000 news sources in JSON format.

Input

{
"APIMode": false,
"dateRange": "today",
"categories": [
"all"
],
"maxArticles": 1000,
"proxyConfiguration": {
"useApifyProxy": false
}
}

Output

[
{
"url": "ARTICLE_URL",
"body": "All_ARTICLE_TEXT_OR_HTML",
"icon": "ARTICLE_IMAGE_URL",
"tags": "ARTICLE_KEYWORDS_ARRAY",
"title": "ARTICLE_TITLE",
"images": "ARTICLE_IMAGE_URLS_ARRAY",
"authors": "WRITERS_NAMES_ARRAY",
"summary": "ARTICLE_SUMMARIZATION",
"category": "ARTICLE_CATEGORY",
"modified": "ARTICLE_MODIFYING_DATE",
"published": "ARTICLE_PUBLISHING_DATE",
"publisher": "PUBLISHING_AGENCY",
"article_type": "ARTICLE_TYPE",
"engagement_score": "ARTICLE_ENGAGEMENT_SCORE_FLOAT"
},
{
"url": "https://www.huffpost.com/entry/donald-trump-election-interference-confession_n_66d5592ce4b0f968d26d1ba2",
"body": "Donald Trump on Sunday tried to defend himself from the criminal charges he’s facing in the election interference case — but experts say it sounded more like a confession. Trump on Fox News bragged that his poll numbers go up every time he’s indicted. “Whoever heard you get indicted for interfering with a presidential election, where you have every right to do it, you get indicted, and your poll numbers go up,” he said. Trump is facing charges in multiple jurisdictions and cases, including election interference in a criminal case filed in federal court in Washington. Last week, he was reindicted to comply with directions from the Supreme Court, which in July ruled that Trump was immune from prosecution for ‘official acts.’ On Sunday, however, Trump flat out said he had ‘every right’ to have been ‘interfering’ with the election. Lawmakers, former prosecutors, attorneys, and other legal minds were ready with a fact-check — and some said it sounded like Trump was admitting to a crime.",
"icon": "https://media.zenfs.com/en/the_huffington_post_584/24223f472f29dff3fae38bd976904683",
"tags": [
"donald trump",
"elections",
"politics",
"election interference",
"presidential election"
],
"title": "‘Are you seriously this stupid?’: legal minds nail Trump after Fox News ‘confession’",
"images": [
"https://media.zenfs.com/en/soaps_732/93418d93bbabc521965f047cb7e06254"
],
"authors": "Ed Mazza",
"summary": "The former president's latest defense backfires on social media.",
"category": "politics",
"modified": "2024-09-02 14:06:54",
"published": "2024-09-02 07:19:12",
"publisher": "HuffPost",
"article_type": "story",
"engagement_score": null
}
]

How to use news API

Sign up for Apify account01

Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.

Get started for free
Install Apify Python client02

Install the Apify Python client using pip: pip install apify-client. This package provides a simple interface to interact with news API from your Python applications.

Get your Apify API token03

Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.

Integrate news API04

Navigate to the news API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more. Use the provided Python code examples to integrate news API into your Python application.

Open news Python API
Get your news data via API05

The news API returns structured JSON data that works perfectly with pandas, NumPy, and other Python data analysis libraries.

Why use Apify?

Never get blocked

Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.

Customers love us

We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.

Monitor your runs

With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.

Export to various formats

Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.

Integrate Apify to your workflow

You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.

Large developer community

Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!

Frequently asked questions

No, there isn't an official Python news API client that provides the comprehensive coverage offered by the Ultimate News Scraper. This Python tool aggregates data from over 1000 different news sources across 25 categories, providing a unified Python interface that would otherwise require connecting to hundreds of individual news APIs. The Python scraper serves as a powerful alternative to fragmented official APIs by offering centralized access to diverse news content with standardized output formats through Python.

Yes, you can try the Ultimate News Scraper Python API client for free using Apify's free tier. The platform offers a "Try for free" option that lets you test the Python API client's capabilities before committing to paid usage. After the free trial, costs are very affordable - approximately $0.1-$0.2 per 1000 articles in Python API client usage, plus a $10 monthly subscription fee, making it highly cost-effective for accessing thousands of news articles through the Python API client.

The Python API client extracts comprehensive data including article titles, summaries, publishers, authors, categories, article types, publication and modification dates, engagement scores, keywords/tags, full article body content, featured images, article URLs, and additional image galleries. The Python API client covers 25 different news categories and can extract up to 5000 articles in 20-30 minutes, with all data available in JSON, CSV, XML, HTML, and Excel formats.

Getting started with our news Python API is easy — simply create a free Apify account, get your API token, and start using the news API in Python, JavaScript, CLI, cURL, OpenAPI, or MCP.

Get started with news API Python client today

Get your first news data in Python in less than 5 minutes. No credit card required. No commitment. Cancel anytime.