Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bing Search Scraper Python

Run the hosted Bing Search Scraper on Apify from the web interface without writing code, or integrate it with Python, JavaScript or cURL to get structured Bing search results.

Browse the technical examples and sample dataset

This repository contains working request examples, realistic sample input, sample SERP output and CSV data. It is useful both for non-technical users who want to understand the Apify workflow and for developers who need an integration example.

What this repository helps you do

  • Retrieve Bing organic results with rank, title, URL, domain and snippet.
  • Track positions for the same keyword across countries and repeated runs.
  • Process up to 1,000 unique queries in one Actor run.
  • Inspect pagination, duplicate removal and query-level SERP features.
  • Export the returned Dataset to JSON, CSV or another downstream format.

Example result

The complete sanitized fixture is available in data/sample-output.json, with a flat tabular version in data/sample-output.csv.

{
  "type": "organicResult",
  "query": "python programming",
  "country": "US",
  "market": "en-US",
  "page": 1,
  "position": 1,
  "title": "Welcome toPython.org",
  "url": "https://www.python.org/",
  "sourceDomain": "python.org",
  "description": "Experienced programmers in any other language can pick up Python very quickly..."
}

The fixture was captured from a validated Bing Actor dataset. Search results change over time, so the sample demonstrates the schema and field relationships; it is not a current ranking guarantee.

Run Bing Search Scraper without code

You can run a Bing search directly from the Apify web interface:

  1. Open Bing Search Scraper on Apify.
  2. In the Input tab, add one or more search terms to Queries.
  3. Optionally choose the country and market, number of pages, result limit, SafeSearch and SERP features.
  4. Click Start to run the Actor.
  5. Open the Dataset tab to inspect the organic results, then export them as JSON, CSV, Excel or JSONL.

For a first test, use the small payload in data/sample-input.json. The web workflow does not require you to install Python or copy an API token into this repository.

See the complete field-by-field walkthrough in docs/no-code-guide.md.

Try Bing Search Scraper with Apify's free plan

Apify's Free plan includes $5 in monthly prepaid usage that can be spent in the Apify Store or on your own Actors. No credit card is required to start, so a small Bing Search Scraper test can often be run with the monthly credit while it is available.

This is not unlimited free usage. Unused credits expire at the end of the billing cycle and do not roll over. See the current Apify pricing before running a larger batch.

Quick start for developers

Python

1. Install the Python client

pip install -r examples/python/requirements.txt

2. Set your Apify token

Linux/macOS:

export APIFY_API_TOKEN="your-token"

Windows PowerShell:

$env:APIFY_API_TOKEN = "your-token"

3. Run the Python example

python examples/python/bing_search_scraper.py

The example reads data/sample-input.json, starts the hosted Actor and prints the returned Dataset items as JSON lines.

Input example

{
  "queries": ["python programming"],
  "country": "US",
  "pagesPerQuery": 3,
  "maxResultsPerQuery": 20,
  "safeSearch": "Moderate",
  "includeSerpFeatures": true,
  "includeAds": false
}

The input file in this repository uses the same complete payload. When processing several keywords, put them in the same queries array so one run can share startup overhead.

See docs/input-reference.md for all fields, limits and supported countries.

Request examples

cURL

examples/curl-request.md calls the synchronous Dataset endpoint with the sample input file.

Python

examples/python/bing_search_scraper.py uses apify-client and reads APIFY_API_TOKEN from the environment. The older request.py filename remains as a compatibility wrapper.

JavaScript

examples/javascript/request.mjs uses the official Apify JavaScript client.

All examples call the hosted Actor. They do not expose a proxy, bypass access controls or require the Actor source code locally.

Output fields

Field Meaning
query The normalized search query used for the row.
country / market The selected country and Bing locale, such as US and en-US.
page / position The Bing page and one-based organic position.
title / url / sourceDomain The result title, resolved destination URL and hostname.
description / date The displayed snippet and optional date shown by Bing.
serpFeatures Optional query-level modules such as related searches, answers and ads.
paginationStoppedReason Why pagination stopped for the query.

See docs/output-reference.md for the complete output contract, including queryStatus rows.

Common use cases

Read docs/use-cases.md for workflows covering:

  • Bing rank tracking by keyword and country.
  • Competitor and SERP visibility research.
  • Batch keyword research and Dataset export.

How to scrape Bing search results with Python

Use examples/python/bing_search_scraper.py when you need a complete Python example that reads an input JSON file, calls the hosted Actor and iterates through the returned Dataset.

For multiple keywords, use examples/python/batch_bing_search.py. It sends several queries in one run and keeps the same output contract for every query.

Bing SERP JSON response example

Each organic result is a separate JSON object with query, country, market, position, title, url, sourceDomain and description. Query-level pagination diagnostics and optional serpFeatures are attached to the row for convenient processing. The complete fixture is in data/sample-output.json.

Export Bing search results to CSV

Use examples/python/export_bing_serp_csv.py to flatten a Dataset JSON export into a CSV file for spreadsheets, reporting or downstream analysis.

FAQ

See docs/faq.md for answers to common questions about the Bing Search API example, pagination, countries, JSON output, CSV export and pricing.

Limits and pricing

  • Up to 1,000 unique queries per run.
  • 1–20 pages per query.
  • Up to 50 unique organic results per query.
  • Results can be localized to 50 supported countries.
  • One delivered organicResult row is one billable event.
  • Current public price: $0.60 per 1,000 organic results delivered.

Empty queries, failed queries, retries and free queryStatus rows are not charged as organic-result events. Check the current price and limits on the Apify Actor page before production use.

Hosted version

Use the hosted Actor when you need repeatable execution, batching, country localization, pagination, API access or Dataset storage without managing the scraping infrastructure yourself:

Run Bing Search Scraper on Apify

Responsible use

Bing controls the result layout and content, so rankings, snippets, dates and optional SERP modules can vary by time, country and SafeSearch setting. The Actor does not solve CAPTCHAs, bypass access controls or access private content.

Use returned data lawfully and respect the terms, access rules and privacy obligations that apply to your use case. Never commit an Apify token or other credentials to this repository.

Support

For an example or documentation problem, open an issue on GitHub with sanitized input and the error message. For an execution problem, include the Apify run ID but never include your token.

License

This repository is released under the MIT License.

About

Examples and sample data for extracting structured Bing SERP results through the Apify Bing Search Scraper.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors