# Bing Images Scraper (`searchapi/bing-images-scraper`) Actor

Scrapes image results from Bing Images search including titles, image URLs, thumbnails, source URLs, dimensions, file format, and rich metadata.

- **URL**: https://apify.com/searchapi/bing-images-scraper.md
- **Developed by:** [Search API](https://apify.com/searchapi) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 0 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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Bing Images Scraper

Search Bing Images and export normalized image records from Bing's structured result-card metadata. The actor uses the website search interface, scrolls the result grid, and keeps only records that contain a full image URL, thumbnail URL, title, and source page URL.

### Input

- `mode`: `single` for one query or `batch` for multiple queries.
- `query`: the primary search query; required in single mode.
- `queries`: up to 20 additional deduplicated queries in batch mode.
- `maxItems`: maximum valid records, from 1 to 1,000. Default: `100`.
- `maxConcurrency`: independent query pages processed in parallel, from 1 to 10.
- `imageSize`: `any`, `small`, `medium`, `large`, or `wallpaper`.
- `safeSearch`: `strict`, `moderate`, or `off`.
- `market`: Bing locale such as `en-US` or `en-GB`.
- `maxScrolls` and `maxStallRounds`: infinite-scroll stopping controls.
- `maxRequestRetries`, `navigationTimeoutSecs`, `requestHandlerTimeoutSecs`, and `resultsWaitSecs`: bounded reliability controls.
- `proxyConfiguration`: Apify Proxy or user-provided proxy configuration.
- `debug`: sanitized scroll-progress logging.

```json
{
  "mode": "single",
  "query": "artificial intelligence",
  "maxItems": 15,
  "imageSize": "any",
  "safeSearch": "moderate",
  "market": "en-US",
  "proxyConfiguration": { "useApifyProxy": false }
}
```

### Output

The 45-field output contract includes:

- Identity and ordering: stable `id`, `imageId`, `contentId`, `thumbnailId`, `cacheKey`, `md5`, `position`, `page`, and `queryPosition`.
- Image data: `imageUrl`, `thumbnailUrl`, `previewImage`, `width`, `height`, `aspectRatio`, `sizePixels`, `fileFormat`, `mimeType`, and `isAnimated`.
- Listing text: `title`, `altText`, `description`, and `caption`.
- Source data: `hostPageUrl`, `sourceUrl`, `hostPageDomain`, `sourceName`, `sourceDomain`, `pageTitle`, and `domain`.
- Search context: `searchQuery`, `query`, `searchUrl`, `market`, `country`, `language`, `engineId`, `searchMetadata`, and `scrapedAt`.

Malformed metadata, results without a source page, duplicate IDs/URLs, challenge pages, and invalid URLs are never pushed. Some fields remain optional because Bing does not expose every identifier on every card.

### Extraction strategy

The actor parses the JSON stored in Bing's `.iusc[m]` result cards. Payloads are parsed defensively and mapped field-by-field; raw metadata is not stored. DOM values provide title/alt fallbacks and dimensions when needed. Crawlee sessions and consistent browser fingerprints are enabled, and proxy input is honored.

### Local verification

```bash
npm ci
npm test
npm run validate:dataset
apify validate-schema
npm run start
apify run --purge --input-file INPUT.json
```

Additional test inputs are available under `test/inputs/` for minimal, filtered, multiple-scroll, and unlikely-query runs. Bing may return fallback images for an unlikely query instead of an empty page; those are retained only when they are genuine structured image results.

# Changelog

This Actor's version history is a separate document: https://apify.com/searchapi/bing-images-scraper/changelog.md

# Actor input Schema

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

Use single for one query or batch to combine Search Query with Search Queries.

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

The search query to use for Bing Images.

## `queries` (type: `array`):

Additional Bing Images queries processed in batch mode. Duplicate and empty values are ignored.

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

Maximum number of image results to scrape.

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

Maximum number of independent query pages processed in parallel.

## `imageSize` (type: `string`):

Filter images by size.

## `safeSearch` (type: `string`):

Apply Bing's SafeSearch filter to the image query.

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

Bing language and market locale, for example en-US or en-GB.

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

Maximum number of infinite-scroll loading steps.

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

Stop after this many scrolls add no new valid images.

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

Retry temporary network, browser, proxy, and rate-limit failures.

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

Maximum time allowed for Bing Images navigation.

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

Maximum time allowed for scrolling and extraction.

## `resultsWaitSecs` (type: `integer`):

Maximum seconds to wait for Bing's structured image cards before classifying the page.

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

Select proxies to be used by the scraper.

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

Enable additional sanitized progress logs.

## Actor input object example

```json
{
  "mode": "single",
  "query": "nature photography",
  "queries": [],
  "maxItems": 100,
  "maxConcurrency": 2,
  "imageSize": "any",
  "safeSearch": "moderate",
  "market": "en-US",
  "maxScrolls": 50,
  "maxStallRounds": 6,
  "maxRequestRetries": 3,
  "navigationTimeoutSecs": 120,
  "requestHandlerTimeoutSecs": 600,
  "resultsWaitSecs": 20,
  "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": "nature photography",
    "queries": [],
    "maxItems": 100,
    "imageSize": "any",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("searchapi/bing-images-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": "nature photography",
    "queries": [],
    "maxItems": 100,
    "imageSize": "any",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("searchapi/bing-images-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": "nature photography",
  "queries": [],
  "maxItems": 100,
  "imageSize": "any",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call searchapi/bing-images-scraper --silent --output-dataset

```

## MCP server setup

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