# Yahoo News Scraper (`scrapeai/yahoo-news-scraper`) Actor

Scrapes news articles from Yahoo News Search (news.search.Yahoo.com). Extracts title, URL, source, snippet, thumbnail, publication date and more.

- **URL**: https://apify.com/scrapeai/yahoo-news-scraper.md
- **Developed by:** [ScrapeAI](https://apify.com/scrapeai) (community)
- **Categories:** News, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Yahoo News Scraper

A high-performance Apify Actor for searching and extracting live news articles from **Yahoo News** (`news.search.yahoo.com`). Extract headlines, direct/clean URLs, publishers, authors, snippets, full image thumbnails, publication dates, categories, and sponsorship status dynamically based on any search query.

***

### ⚡ Key Features

- 🔍 **Dynamic Keyword Search**: Scrape news for any topic, entity, company ticker, or keyword.
- 💎 **Richest Real-Time Metadata**: Extracts title, destination URL, source/publisher, author, article excerpt, high-res thumbnail, published time, category, and sponsorship tag.
- 🕒 **Time Recency Filtering**: Filter by past 24 hours (`1d`), past week (`7d`), or past month (`30d`).
- ⚡ **Sorting Options**: Sort by search relevance or newest first (`date`).
- 🌐 **International & Multilingual Support**: Custom country/region locale and language support.
- 🔄 **Smart Pagination**: Automatically traverses search result pages until your target `maxItems` is reached.
- 🛡️ **Anti-Bot & Proxy Ready**: Built with Playwright stealth navigation and Apify Proxy integration.

***

### 📋 Input Configuration

The Actor accepts input in JSON format. All fields are dynamically configurable:

| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| `query` | `string` | `"technology"` | **Yes** | Search term or phrase to search on Yahoo News. |
| `maxItems` | `integer` | `50` | No | Maximum number of articles to extract (1 to 500). |
| `timeRange` | `string` | `""` | No | Filter by recency: `""` (Any Time), `"1d"` (Past 24 Hours), `"7d"` (Past Week), `"30d"` (Past Month). |
| `sortBy` | `string` | `""` | No | Sort results: `""` (Relevance) or `"date"` (Newest first). |
| `country` | `string` | `"lang_en"` | No | Country / locale identifier (e.g., `lang_en`, `lang_de`, `lang_fr`, `us`). |
| `language` | `string` | `"en"` | No | Language code (e.g., `en`, `de`, `fr`, `es`). |
| `proxyConfiguration` | `object` | `{"useApifyProxy": true}` | No | Proxy settings. Residential proxy is recommended for high-volume scrapes. |

#### Example Input (`INPUT.json`)

```json
{
  "query": "artificial intelligence",
  "maxItems": 20,
  "timeRange": "7d",
  "sortBy": "date",
  "country": "lang_en",
  "language": "en"
}
```

***

### 📦 Output Dataset Schema

Each scraped news article produces a clean, structured JSON object:

```json
{
  "position": 1,
  "title": "D-Wave Quantum vs. Microsoft: Which Is the Better Quantum Computing Stock to Own...",
  "url": "https://finance.yahoo.com/markets/stocks/articles/d-wave-quantum-vs-microsoft-075700700.html",
  "source": "Motley Fool · via Yahoo Finance",
  "author": null,
  "snippet": "Owning shares of Microsoft gives you exposure to quantum computing's potential without sacrificing...",
  "thumbnail": "https://s.yimg.com/fz/api/res/1.2/voXodaoRiBh1U_dJFRm63A--~C/YXBwaWQ9c3JjaGRkO2ZpPWZpbGw7aD0xMDY7cHhvZmY9MDtweW9mZj0wO3E9ODA7c209MTt3PTE2MA--/https://media.zenfs.com/en/motleyfool.com/90b8193ea103c1408ea093ff77313a87.jpg",
  "publishedAt": "1 day ago",
  "category": "Markets",
  "isSponsored": false,
  "searchQuery": "quantum computing",
  "country": "lang_en",
  "language": "en",
  "scrapedAt": "2026-08-20T11:57:02.548Z"
}
```

#### Output Field Descriptions

- **`position`** (`integer`): Result index in the search stream.
- **`title`** (`string`): Cleaned headline of the news article.
- **`url`** (`string`): Full link directly to the publisher or Yahoo News article.
- **`source`** (`string`): Original news organization / media provider name.
- **`author`** (`string` or `null`): Byline author if present on the search card.
- **`snippet`** (`string`): Article summary or excerpt.
- **`thumbnail`** (`string` or `null`): Direct URL to the article preview image.
- **`publishedAt`** (`string`): Publication timestamp (e.g. `"2 hours ago"`, `"1 day ago"`, ISO date).
- **`category`** (`string` or `null`): News category or vertical (e.g. `Markets`, `Technology`, `Politics`).
- **`isSponsored`** (`boolean`): Whether the article is marked as promoted / sponsored.
- **`searchQuery`** (`string`): The search query used for this scrape run.
- **`country`** (`string`): Country/locale code used in the search.
- **`language`** (`string`): Language code used in the search.
- **`scrapedAt`** (`string`): ISO 8601 timestamp of when the record was extracted.

***

### 🚀 How to Run

#### 1. Locally

Ensure you have [Node.js](https://nodejs.org/) (v18+) installed:

```bash
## Clone the repository and install dependencies
npm install

## Run the scraper
npm start

## Validate generated datasets against the schema
npm test
```

#### 2. Apify CLI

```bash
## Run locally with Apify CLI
apify run

## Push and deploy to your Apify account
apify push
```

#### 3. Apify API (Node.js)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({
    token: 'YOUR_APIFY_TOKEN',
});

const run = await client.actor('YOUR_USERNAME/yahoo-news-scraper').call({
    query: 'electric vehicles',
    maxItems: 30,
    timeRange: '1d',
    sortBy: 'date',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### 4. Apify API (Python)

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_APIFY_TOKEN')

run_input = {
    "query": "space exploration",
    "maxItems": 25,
    "timeRange": "7d",
    "sortBy": "date"
}

run = client.actor("YOUR_USERNAME/yahoo-news-scraper").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"[{item['publishedAt']}] {item['title']} - {item['url']}")
```

***

### 💡 Practical Use Cases

- **Media & PR Monitoring**: Track brand mentions, PR releases, and media presence across international publishers.
- **Market & Financial Intelligence**: Stream breaking news for stock tickers, commodities, cryptos, and industries.
- **AI & NLP Training**: Ingest up-to-the-minute real news headlines for LLM retrieval-augmented generation (RAG) and sentiment models.
- **Content Aggregation**: Power automated newsletters, Slack/Discord bots, and RSS-style newsfeeds.

***

### 📄 License

ISC

# Actor input Schema

## `query` (type: `string`):

The news search query on Yahoo News.

## `maxItems` (type: `integer`):

Maximum number of news articles to scrape.

## `country` (type: `string`):

Yahoo language/country code (e.g. 'lang\_en', 'lang\_de', 'lang\_fr').

## `language` (type: `string`):

Yahoo language code (e.g. 'en', 'de', 'fr').

## `timeRange` (type: `string`):

Filter news by recency.

## `sortBy` (type: `string`):

Sort news results by relevance or date.

## `proxyConfiguration` (type: `object`):

Proxy settings. Residential proxies recommended.

## Actor input object example

```json
{
  "query": "technology",
  "maxItems": 50,
  "country": "lang_en",
  "language": "en",
  "timeRange": "",
  "sortBy": "",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all scraped news articles

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "technology",
    "maxItems": 50,
    "country": "lang_en",
    "language": "en",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeai/yahoo-news-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "technology",
    "maxItems": 50,
    "country": "lang_en",
    "language": "en",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapeai/yahoo-news-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "technology",
  "maxItems": 50,
  "country": "lang_en",
  "language": "en",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call scrapeai/yahoo-news-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeai/yahoo-news-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pcwFRcgl0PXhwa6py/builds/v2q85qV0P9xJcxVNl/openapi.json
