# Bing News Scraper (`searchapi/bing-news-scraper`) Actor

Searches Bing News and extracts source-backed article-card details, publication information, thumbnails, publisher data, and search metadata.

- **URL**: https://apify.com/searchapi/bing-news-scraper.md
- **Developed by:** [Search API](https://apify.com/searchapi) (community)
- **Categories:** News, 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 search 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/actors/running/actors-in-store.md#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

## Bing News Scraper

Search Bing News through its normal search interface and collect the data shown on each article card. The Actor supports Bing sorting, time range, market, numbered pagination, result limits, proxies, sessions, and consistent browser fingerprints.

### Input

Search mode is the recommended workflow; users provide the values they would enter or select on Bing News.

| Field | Default | Purpose |
| --- | --- | --- |
| `query` | UI prefill: `artificial intelligence` | Search keywords |
| `market` | `en-US` | Language-country market |
| `sortBy` | `date` | `date` or `relevance` |
| `timeRange` | `any` | `any`, `day`, `week`, or `month` |
| `maxItems` | `50` | Maximum unique records across the run |
| `maxPages` | `50` | Maximum numbered result pages |
| `maxScrolls` | `60` | Lazy-loading scroll attempts per page |
| `maxStallRounds` | `2` | Consecutive scrolls with no new cards before stopping |
| `scrollDelayMs` | `1000` | Wait after each scroll |
| `maxConcurrency` | `1` | Concurrent result pages |
| `maxRequestRetries` | `3` | Temporary-failure retries |
| `navigationTimeoutSecs` | `90` | Navigation timeout |
| `requestHandlerTimeoutSecs` | `600` | Page-processing timeout |
| `proxyConfiguration` | proxy disabled | Apify or custom proxy settings |

The backward-compatible `urls` mode accepts only `https://www.bing.com/news/search` URLs. Search mode does not require users to construct URLs.

### Dataset

The documented 43-field contract contains:

- Bing IDs: article ID and topic cluster ID.
- Listing text: title, snippet/description, publisher, category when Bing shows one.
- Links: article URL, domain, and Bing's publisher-search link.
- Publication data: Bing's raw/relative text plus a derived ISO-8601 timestamp when the text is parseable.
- Media: Bing's public high-quality thumbnail URL and source dimensions.
- Listing flags: breaking, paywall, and sponsored badges when present.
- Search context: query, market, country, language, page, sorting, time filter, extraction method, and one consistent scrape timestamp.

Optional fields are omitted when the current card does not expose them. Embedded base64 publisher logos and fabricated third-party favicon URLs are not stored. The Actor never opens article pages or invents article details that are absent from Bing's listing.

### Extraction and pagination

Bing currently returns search and lazy-loaded news batches as HTML, not a stable structured JSON results API, so the Actor uses a focused DOM mapper with a conservative external-link fallback. Market-specific Bing pages often expose 8-10 results per numbered page; the Actor follows `first` offsets until `maxItems`, `maxPages`, or an explicit no-results page is reached. Records are deduplicated by Bing article ID or canonical article URL and are ordered deterministically before one dataset push.

### Reliability and security

- Validates response status and HTML content type before extraction.
- Detects block/challenge pages and marks the browser session bad.
- Distinguishes explicit no-results pages from selector failures.
- Uses Bing's current `interval` and `sortbydate` controls and independently rejects records outside a requested day/week/month range.
- Uses bounded retries, persistent per-session cookies, Apify/custom proxies, and consistent Crawlee fingerprints.
- Logs counts and sanitized targets without response bodies, cookies, credentials, or proxy URLs.
- Restricts output URLs to HTTP(S) and excludes embedded data URLs.

### Local verification

```sh
npm ci
npm test
apify validate-schema
apify run --purge --input-file INPUT.json
node test/audit-dataset.js --expected=20
```

Fixtures under `test/fixtures` cover minimal, filtered multi-page, concurrent URL-mode, empty-result, and invalid inputs.

# Actor input Schema

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

Keywords to enter in Bing News search.

## `market` (type: `string`):

Language-country market, for example en-US, en-GB, or de-DE.

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

Use Bing's most recent or best-match ordering.

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

Limit results by Bing's time-range filter.

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

Maximum unique news records across the whole run.

## `maxPages` (type: `integer`):

Maximum numbered Bing News result pages to request.

## `mode` (type: `string`):

Search is recommended. URLs mode is retained for compatible Bing News result URLs.

## `startUrls` (type: `array`):

Optional Bing News search-result URLs used only in URLs mode.

## `maxScrolls` (type: `integer`):

Maximum lazy-loading scroll attempts per result page.

## `maxStallRounds` (type: `integer`):

Stop after this many scrolls add no new results.

## `scrollDelayMs` (type: `integer`):

Wait after each scroll so Bing can load more cards.

## `maxConcurrency` (type: `integer`):

Maximum result pages processed concurrently.

## `maxRequestRetries` (type: `integer`):

Retries for temporary navigation, rate-limit, or browser failures.

## `navigationTimeoutSecs` (type: `integer`):

Maximum time allowed for page navigation.

## `requestHandlerTimeoutSecs` (type: `integer`):

Maximum total processing time per result page.

## `headless` (type: `boolean`):

Run Chromium without a visible window.

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

Use no proxy, Apify Proxy, or custom proxy URLs.

## `debug` (type: `boolean`):

Enable additional non-sensitive diagnostics.

## Actor input object example

```json
{
  "query": "artificial intelligence",
  "market": "en-US",
  "sortBy": "date",
  "timeRange": "any",
  "maxItems": 50,
  "maxPages": 50,
  "mode": "search",
  "maxScrolls": 60,
  "maxStallRounds": 2,
  "scrollDelayMs": 1000,
  "maxConcurrency": 1,
  "maxRequestRetries": 3,
  "navigationTimeoutSecs": 90,
  "requestHandlerTimeoutSecs": 600,
  "headless": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "debug": false
}
```

# 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": "artificial intelligence"
};

// Run the Actor and wait for it to finish
const run = await client.actor("searchapi/bing-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": "artificial intelligence" }

# Run the Actor and wait for it to finish
run = client.actor("searchapi/bing-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": "artificial intelligence"
}' |
apify call searchapi/bing-news-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,searchapi/bing-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/YWhdBk5yg2fOXEblJ/builds/q9oZs4a6fccas4RkV/openapi.json
