16 AI Prompts for Web Scraping

The best Web Scraping prompts in the Coding library. Tested on ChatGPT, Claude, Gemini and every major model.

Browse the prompts

## Role

You are an expert web scraping engineer specializing in ethical data extraction, Python development, and compliance with website policies and robots.txt standards.

## Task

Generate a complete, production-ready Python web scraping script that extracts structured data from the specified URLs while adhering to ethical scraping practices: robots.txt compliance, rate limiting, graceful error handling, user-agent rotation, and proper attribution.

## Context

{{scraping-requirements}}

The script must:
- Check and respect robots.txt before scraping
- Implement polite request delays and user-agent rotation
- Identify appropriate HTML selectors with fallback logic for structure changes
- Detect and handle pagination automatically
- Include comprehensive error handling and logging
- Output clean, timestamped data with source attribution
- Be modular, well-documented, and maintainable

Generate Web Scraping Script

Generates production-ready Python web scraping scripts that respect robots.txt, implement rate limiting, and extract structured data ethically. Runs on ChatGPT, Claude, and Cursor.

72
You are an expert Python web scraper developer specializing in robust, production-grade data extraction.

Write a resilient paginated scraper that meets these requirements:

**Core functionality**
- Automatically detect and handle three pagination patterns: numbered page query parameters (e.g., `?page=2`), "next" link elements, or infinite-scroll lazy-load endpoints
- Extract items from {{target-url}} matching the CSS selector or XPath {{item-selector}}
- Store extracted data as {{output-format}} (JSON, CSV, or SQLite)

**Resilience & recovery**
- Checkpoint progress to `.scraper_state.json` after successfully scraping each page (store: last completed page number/URL, item count, timestamp)
- On startup, read checkpoint and resume from the next page; skip already-completed pages
- Implement exponential backoff for failed requests: initial 1s delay, doubling up to 60s max, retry up to 5 t

Paginated Scraper With Resume Support

Generate a resilient paginated scraper with automatic pagination detection and recovery features using Python.

9

Horse Racing Data Scraper

Automate horse racing data collection with this AI prompt, streamlining information gathering from multiple websites including your RacingTV account.

8

Scraper Breakage Detection Harness

Generate a test harness for web scrapers to detect silent breakage due to site markup changes. Produces code output.

8

Playwright Browser Automation Scraper

Generate a production-ready scraping script for JavaScript-rendered sites using Playwright. Produces structured JavaScript output with handling for common obstacles like overlays and lazy-loads.

8
You are a web scraping compliance and reliability auditor with expertise in ethical data collection, legal requirements, and production-grade scraper architecture.

Review the scraper code below for compliance, reliability, and best practices. Examine:

1. **robots.txt handling** – Does the code fetch and respect robots.txt? Are disallowed paths honored? Is the crawl-delay directive observed?
2. **Request rate & concurrency** – Are requests throttled appropriately? Does concurrency risk overwhelming the target server?
3. **User-Agent honesty** – Is the User-Agent string present, accurate, and identifying? Does it include contact information?
4. **Caching strategy** – Does the scraper cache responses to avoid redundant requests? Are conditional requests (ETag, Last-Modified) used where applicable?
5. **Retry & backoff behavior** – Are transient errors retried? Is exponential backoff imple

Polite Scraper Compliance Checklist

Generate a compliance and reliability review for a web scraper, including guidance for ethical and legal practices.

7
You are an expert HTML parser engineer specializing in robust data extraction from inconsistent markup.

# Task
Write a complete parser that extracts structured data from messy real-world HTML and returns clean JSON matching the user's schema. The parser must handle:

- Inconsistent markup (missing closing tags, nested wrappers, irregular nesting)
- Inline scripts, comments, and extraneous elements
- Multiple selector strategies (ID, class, data attributes, text content matching)
- Type coercion: strings to numbers, date parsing, boolean normalization
- Null for genuinely absent fields (never guess or fabricate data)

# Input HTML
```html
{{html-input}}
```

# Target Schema
```json
{{target-schema}}
```

# Requirements

## Parser Function
- Use a robust HTML parsing library (BeautifulSoup for Python, cheerio/jsdom for Node.js, Nokogiri for Ruby)
- Implement fallback selection logic: try 

HTML to Structured JSON Parser

Generate a robust HTML parser and validation function to convert messy HTML into structured JSON matching a user-supplied schema.

7

Business Directory Contact Extractor

Generate a Python script to extract business contact information from a public directory, ensuring compliance with web scraping ethics and data protection laws.

6

Article Content Extractor for Research

Generate a Python script that scrapes and extracts structured article content from news or blog pages using readability heuristics.

6
You are an expert Python developer specializing in ethical web scraping and data engineering.

Build a scheduled price-tracking scraper that monitors competitor products over time and detects significant price changes.

# Requirements

## Input
{{scraper-config}}

## Core Features

**Data Collection**
- Extract product identifier, current price, and timestamp on each run
- Append new records to a persistent CSV or SQLite historical store (never overwrite)
- Handle missing prices, unavailable products, and parsing errors gracefully

**Change Detection**
- Compare current prices against the most recent prior record for each product
- Flag any price change that exceeds the threshold specified in the config
- Calculate both absolute change (currency units) and percentage change

**Reporting**
- Generate a simple summary after each run showing:
  - Products with flagged changes, sorted by mag

Competitor Price Monitoring Scraper

Generate a Python-based web scraper for tracking and reporting competitor product price changes over time, with ethical compliance.

6
You are an HTML table extraction specialist. Your task is to parse HTML table markup into clean, spreadsheet-ready tabular data.

# Input

{{html-table-markup}}

# Extraction Requirements

**Structure normalization**
- Resolve merged cells (colspan/rowspan) by repeating values across the logical cells they span
- Flatten multi-row headers into a single header row using "Parent | Child" notation for nested columns
- Remove footnote rows, caption rows, and any non-data rows; note their content in your summary
- If the table appears split across pages (repeated headers mid-table), consolidate into one continuous dataset

**Data cleaning**
- Strip thousands separators (commas, spaces, periods used as separators)
- Remove currency symbols (Β£, $, €, Β₯, etc.) but note the currency in your summary
- Preserve numeric precision; do not round
- Normalize date formats to ISO 8601 (YYYY-MM-DD) where 

Web Table to Spreadsheet Converter

Generate spreadsheet-ready data from HTML table markup, handling complex structures and data cleaning.

5

Customer Contact Information Scraper

Generate customer contact databases with this AI prompt, extracting primary contact names, job titles, email addresses, and phone numbers efficiently.

4

Product Review Scraper for Sentiment Analysis

Generate a web scraper script that collects and cleans product reviews for sentiment analysis.

4

Ecommerce Product Listing Scraper

Generate a Python web scraper script that extracts product data from e-commerce category pages into a CSV file, following ethical standards.

4
You are an expert web scraper specialising in job-board data extraction and normalisation.

Write a complete, production-ready Python scraper that collects job postings from {{target-url}} and outputs them into a structured CSV tracker with the following columns:

- role_title
- company
- location (normalised to "City, Country" or "Remote")
- remote_status (one of: Full Remote | Hybrid | On-site | Not Specified)
- salary_range (normalised to "$min–$max currency/period" or "Not Listed")
- posting_date (ISO 8601 format YYYY-MM-DD, inferred if relative like "2 days ago")
- application_link (absolute URL)
- listing_id (unique stable identifier derived from the posting to enable deduplication)
- status (Active | Closed)
- last_seen (ISO 8601 timestamp of last successful scrape)

## Functional requirements

1. **Deduplication logic**: use listing_id to detect reposts. If a job with the same li

Job Listing Scraper and Tracker

Generate a robust web scraper in Python that extracts and tracks job postings in a structured CSV format from specified job boards.

4
## Role

You are an expert market intelligence analyst and strategic event researcher specializing in B2B tech and real estate networking opportunities.

## Task

Create a comprehensive, prioritized event intelligence report that identifies high-value networking and business development opportunities for the user's company. Research and analyze tech conferences, real estate conventions, product launches, and investor networking events across multiple categories: major tech conferences, real estate industry conventions, property launches, Eventbrite networking events, B2B technology summits, AI-focused conferences, and investor networking dinners.

## Context

{{company-and-product}}

{{target-customer-profile}}

{{company-stage-and-funding}}

{{event-budget}}

{{business-objectives}}

## Research Requirements

For each identified event, document: event name and date, location, ticket and

Event Scraper and Analyzer

Generate targeted event opportunities with this AI prompt, finding conferences, conventions, investor meetings, exhibitor pricing, success metrics, and strategic recommendations.

2

What are AI prompts for Web Scraping?

AI prompts for Web Scraping are engineered instructions that already work. These are not one-line questions. Each one fixes the role, the context, the task and the output format before you type a word, so you get a usable result on the first run instead of the fourth.

They cover the work Web Scraping actually get asked for: research and briefs, copy and content, analysis and reporting, planning, outreach and the admin that eats the day. Open a card to see the full prompt and the output it returns.

Popular on this page right now: "Generate Web Scraping Script", "Paginated Scraper With Resume Support", "Horse Racing Data Scraper".

16 on this page, every one scoped to Web Scraping. Free to read, free to copy.

Why these prompts work for Web Scraping

A weak prompt costs you the hour you were trying to save: you rewrite it three times, get something generic, then finish the job by hand. An engineered prompt front-loads that thinking once.

In Web Scraping that means first drafts you can send, analysis you can act on, and the repetitive work handed off, so the time goes into judgement instead of typing.

Every prompt here was written for a real job and tested against the models people actually use. Nothing scraped from a thread.

How to use these prompts

Open a prompt, copy it, and replace the [bracketed] variables with your own product, audience or topic. The structure around them stays as is. That structure is the part doing the work.

Paste it into ChatGPT, Claude, Gemini, Grok or the model you already use. If the output drifts, tighten the context line instead of rewriting the whole prompt.

No account needed to copy one. No setup, no extension, nothing to install.

Which AI tool works best for Web Scraping prompts?

Text prompts here run well in ChatGPT, Claude, Gemini and Grok; image prompts target Midjourney and Nano Banana. Each card lists the models it was tested with.

Are these AI prompts free to use?

A big part of the library is free: open a prompt, copy it, use it. Premium packs and the Complete AI Bundle unlock the full collection with lifetime updates.

How do I adapt these prompts to my use case?

Start with the [variables]: niche, audience, constraints. If the result still misses, add one example of the output you want. A single good example beats three extra instructions.

For a prompt built from scratch, the Start Now card above opens the custom prompt generator.

Related resources

Get smarter on AI every week

One email a week with the best new prompts, tools, and model updates. Unsubscribe anytime.

Join 100,000+ subscribers. One email a week, real prompts, tools, and model updates. Unsubscribe anytime.