#ExtractSummit2026 The world's largest web scraping conference returns. Austin Oct 7–8 · Dublin Nov 10–11.

Register now
Data Services
Pricing
Login
Try Zyte APIContact Sales
  • Unblocking and Extraction

    Zyte API

    The ultimate API for web scraping. Avoid website bans and access a headless browser or AI Parsing

    Ban Handling

    Headless Browser

    AI Extraction

    SERP

    Enterprise

    DocumentationSupport

    Hosting and Deployment

    Scrapy Cloud

    Run, monitor, and control your Scrapy spiders however you want to.

    Coding Agent Add-Ons

    Agentic Web Data

    Plugins that give coding agents the context to build production Scrapy projects. Starts with Claude Code.

  • Data Services
  • Pricing
  • Browse

    • BlogArticles, podcasts, videos
    • Case studiesCustomer outcomes
    • White papersIn-depth reports
    • DocumentationGuides & API reference
    • EventsConferences, webinars, recordings

    Subscribe

    • NewsletterSwiftly delivered
    • Join our community2,000+ web scraping engineers
  • Product and E-commerce

    From e-commerce and online marketplaces

    Data for AI

    Collect and structure web data to feed AI

    Job Posting

    From job boards and recruitment websites

    Real Estate

    From Listings portals and specialist websites

    News and Article

    From online publishers and news websites

    Search

    Search engine results page data (SERP)

    Social Media

    From social media platforms online

  • Meet Zyte

    Our story, people and values

    Contact us

    Get in touch

    Support

    Knowledge base and raise support tickets

    Terms and Policies

    Accept our terms and policies

    Open Source

    Our open source projects and contributions

    Web Data Compliance

    Guidelines and resources for compliant web data collection

    Join the team building the future of web data
    We're Hiring
    Trust Center
    Security, compliance & certifications
Login
Try Zyte APIContact Sales
All articles
AI71, 71 articles
Data quality15, 15 articles
Developer interest59, 59 articles
Integration2, 2 articles
Open-source50, 50 articles
Proxies35, 35 articles
Scraping practice35, 35 articles
Scraping strategy47, 47 articles
Search results4, 4 articles
Web data74, 74 articles
Web scraping APIs49, 49 articles
Scrapy47, 47 articles
Scrapy Cloud26, 26 articles
Web Scraping Copilot11, 11 articles
Zyte API65, 65 articles
AI & Machine Learning3, 3 articles
Automotive3, 3 articles
E-commerce & retail33, 33 articles
Entertainment & Streaming2, 2 articles
Financial Services8, 8 articles
Government2, 2 articles
Market Research & Intelligence7, 7 articles
Media & publishing11, 11 articles
Real Estate2, 2 articles
Recruitment & HR3, 3 articles
Transportation & Logistics2, 2 articles
Travel & hospitality3, 3 articles
iPaaS2, 2 articles
Large language model29, 29 articles
MCP3, 3 articles
Python110, 110 articles
Scraping at Scale7, 7 articles
Scraping Fundamentals11, 11 articles
Web Scraping Industry Report20, 20 articles

Appearance

Discord Community
BlogLearnThe Modern Scrapy Developer's Guide (Part 3): Auto-Generating Page Objects with the Web Scraping Copilot
Learn

The Modern Scrapy Developer's Guide (Part 3): Auto-Generating Page Objects with the Web Scraping Copilot

5 min read · December 16, 2025

Scrapy Wsc Banner

The Modern Scrapy Developer's Guide (Part 3): Auto-Generating Page Objects with Web Scraping Copilot

Welcome to Part 3 of our Modern Scrapy series.

  • In Part 1, we built a basic crawling spider.
  • Part 2 we refactored it into a professional, scalable architecture using scrapy-poet.

That refactor was a huge improvement, but it was still a lot of manual work. We had to:

  • Manually create our BookItem and BookListPage schemas.
  • Manually create the bookstoscrape_com.py Page Object file.
  • Manually use scrapy shell to find all the CSS selectors.
  • Manually write all the @field parsers.

What if you could do all of that in about 30 seconds?

In this guide, we'll show you how to use Web Scraping Copilot (our VS Code extension) to automatically write 100% of your Items, Page Objects, and even your unit tests. We'll take our simple spider from Part 1 and upgrade it to the professional scrapy-poet architecture from Part 2, but this time, the AI will do all the heavy lifting.


On This Page (Table of Contents)

  1. Prerequisites (Part 1 & VS Code)
  2. Step 1: Installing the Web Scraping Copilot Extension
  3. Step 2: Auto-Generating our BookItem
  4. Step 3: Running the AI-Generated Tests
  5. Step 4: Refactoring the Spider (The Easy Way)
  6. Step 5: Auto-Generating our BookListPage
  7. Conclusion: The "Hybrid Developer"

Prefer to watch?

Here's a livestream where I talk through and show our extension working, coding live

Prerequisites & Setup

This tutorial assumes you have:

  • Completed Part 1: Building Your First Crawling Spider. We will start from this simpler spider.
  • Visual Studio Code installed.
  • The Web Scraping Copilot extension (which we'll install now).

Step 1: Installing the Web Scraping Copilot

Inside VS Code, go to the "Extensions" tab and search for Web Scraping Copilot (published by Zyte).

Once installed, you'll see a new icon in your sidebar. Open it, and it will automatically detect your Scrapy project. It may ask to install a few dependencies like pytest—allow it to do so. This setup process ensures your environment is ready for AI-powered generation.


Step 2: Auto-Generating our BookItem

Let's start with the spider from Part 1. Our goal is to create a Page Object for our BookItem and add even more fields than we did in Part 2.

In the Copilot chat window:

  1. Select "Web Scraping."
  2. Write a prompt like this:

"Create a page object for the item BookItem using the sample URL https://books.toscrape.com/catalogue/the-host\_979/index.html"

The copilot will now:

  • Check your project: It will confirm you have scrapy-poet and pytest (and will offer to install them if you don't).
  • Add scrapy-poet settings: It will automatically add the ADDONS and SCRAPY_POET_DISCOVER settings to your settings.py file.
  • Create your items.py: It will create a new BookItem class, but this time it will intelligently add all the fields it can find on the page.
1# tutorial/items.py (Auto-Generated!)
2import attrs
3
4@attrs.define
5class BookItem:
6    """
7    The structured data we extract from a book *detail* page.
8    """
9    name: str
10    price: str
11    url: str
12    availability: str  # <-- New!
13    number_of_reviews: int # <-- New!
14    upc: str             # <-- New!
Copy
  • Create Fixtures: It creates a fixtures folder with the saved HTML and expected JSON output for testing.
  • Write the Page Object: It creates the tutorial/pages/bookstoscrape_com.py file and writes the entire Page Object, complete with all parsing logic and selectors, for all the new fields.
1# tutorial/pages/bookstoscrape_com.py (Auto-Generated!)
2
3from web_poet import WebPage, handle_urls, field, returns
4from tutorial.items import BookItem
5
6@handle_urls("books.toscrape.com/catalogue")
7@returns(BookItem)
8class BookDetailPage(WebPage):
9    """
10    This Page Object handles parsing data from book detail pages.
11    """
12
13    @field
14    def name(self) -> str:
15        return self.response.css("h1::text").get()
16
17    @field
18    def price(self) -> str:
19        return self.response.css("p.price_color::text").get()
20
21    @field
22    def url(self) -> str:
23        return self.response.url
24
25    # All of this was written for us!
26    @field
27    def availability(self) -> str:
28        return self.response.css("p.availability::text").getall()[1].strip()
29
30    @field
31    def number_of_reviews(self) -> int:
32        return int(self.response.css("table tr:last-child td::text").get())
33
34    @field
35    def upc(self) -> str:
36        return self.response.css("table tr:first-child td::text").get()
Copy

In 30 seconds, the Copilot has done everything we did manually in Part 2, but better—it even added more fields.


Step 3: Running the AI-Generated Tests

The best part? The Copilot also wrote unit tests for you. It created a tests folder with test_bookstoscrape_com.py.
You can just click "Run Tests" in the Copilot UI (or run pytest in your terminal).

1$ pytest
2================ test session starts ================
3...
4tests/test_bookstoscrape_com.py::test_book_detail[book_0] PASSED
5tests/test_bookstoscrape_com.py::test_book_detail[book_1] PASSED
6...
7================ 8 tests passed in 0.10s ================
Copy

Your parsing logic is now fully tested, and you didn't write a single line of test code.


Step 4: Refactoring the Spider (The Easy Way)

Now, we just update our tutorial/spiders/books.py to use this new architecture, just like in Part 2.

1# tutorial/spiders/books.py
2
3import scrapy
4# Import our new, auto-generated Item class
5from tutorial.items import BookItem
6
7class BooksSpider(scrapy.Spider):
8    name = "books"
9    # ... (rest of spider from Part 1) ...
10
11    async def parse_listpage(self, response):
12        product_urls = response.css("article.product_pod h3 a::attr(href)").getall()
13        for url in product_urls:
14            # We just tell Scrapy to call parse_book
15            yield response.follow(url, callback=self.parse_book)
16
17        next_page_url = response.css("li.next a::attr(href)").get()
18        if next_page_url:
19            yield response.follow(next_page_url, callback=self.parse_listpage)
20
21    # We ask for the BookItem, and scrapy-poet does the rest!
22    async def parse_book(self, response, book: BookItem):
23        yield book
Copy

Step 5: Auto-Generating our BookListPage

We can repeat the exact same process for our list page to finish the refactor.

Prompt the Copilot:

"Create a page object for the list item BookListPage using the sample URL https://books.toscrape.com/catalogue/category/books/fantasy\_19/index.html"

Result:

  • The Copilot will create the BookListPage item in items.py.
  • It will create the BookListPageObject in bookstoscrape_com.py with the parsers for book_urls and next_page_url.
  • It will write and pass the tests.

Now we can update our spider one last time to be fully architected.

1# tutorial/spiders/books.py (FINAL VERSION)
2
3import scrapy
4from tutorial.items import BookItem, BookListPage # Import both
5
6class BooksSpider(scrapy.Spider):
7    # ... (name, allowed_domains, url) ...
8
9    async def start(self):
10        yield scrapy.Request(self.url, callback=self.parse_listpage)
11
12    # We now ask for the BookListPage item!
13    async def parse_listpage(self, response, page: BookListPage):
14
15        # All parsing logic is GONE from the spider.
16        for url in page.book_urls:
17            yield response.follow(url, callback=self.parse_book)
18
19        if page.next_page_url:
20            yield response.follow(page.next_page_url, callback=self.parse_listpage)
21
22    async def parse_book(self, response, book: BookItem):
23        yield book
Copy

Our spider is now just a "crawler." It has zero parsing logic. All the hard work of finding selectors and writing parsers was automated by the Copilot.


Conclusion: The "Hybrid Developer"

The Web Scraping Copilot doesn't replace you. It accelerates you. It automates the 90% of work that is "grunt work" (finding selectors, writing boilerplate, creating tests) so you can focus on the 10% of work that matters: crawling logic, strategy, and handling complex sites.

This is how we, as the maintainers of Scrapy, build spiders professionally.

What's Next? Join the Community.

💬 TALK: Have questions about the Copilot? Ask the author and 20k+ devs in our Discord.

▶️ WATCH: This post was based on our video! Watch the full walkthrough on our YouTube channel.

📩 READ: Want more advanced Scrapy tips? Get the Extract Community newsletter so you don't miss it.

In this article

  • The Modern Scrapy Developer's Guide (Part 3): Auto-Generating Page Objects with Web Scraping Copilot
  • On This Page (Table of Contents)
  • Prefer to watch?
  • Prerequisites & Setup
  • Step 1: Installing the Web Scraping Copilot
  • Step 2: Auto-Generating our BookItem
  • Step 3: Running the AI-Generated Tests
  • Step 4: Refactoring the Spider (The Easy Way)
  • Step 5: Auto-Generating our BookListPage
  • Conclusion: The "Hybrid Developer"

Selected chapter & lessons

Learn Scrapy

  • Scrapy Tutorial Part 1: First Spider
  • Scrapy Tutorial Part 2: Page Objects
  • Scrapy Tutorial Part 3: Web Scraping CoPilot

Other lessons

What is web scraping?

  • What Is Web Scraping?
  • What are the elements of a web scraping project?
  • Python Web Scaping Tools & Libraries
  • How to architect a web scraping solution: The step-by-step guide
  • Web crawling vs web scraping
  • Is Web & Data Scraping Legally Allowed?
  • Compliant Web Scraping Checklist
  • Best practices for web scraping
  • A Guide to Web Scraping With Java
  • Transition from Zenrows to Zyte API
  • Guide to Web Scraping APIs
  • Screen Scraping Explained
  • Large Scale Web Scraping with Python
  • Large Scale Web Scraping with Python
  • Building a Web Crawler in Python
  • A Practical Guide to XML Parsing with Python
  • Learn How to Scrape a Website
  • Advanced Use Cases for Session Management
  • Golang Web Scraping in 2025
  • Web Scraping Dynamic Websites With Zyte API
  • What is Data Parsing in Web Scraping?
  • Scrape Web Pages and Files Using Python, wget, and Zyte

Web Scraping How-to Videos

  • Web scraping videos

SERP Data Collection at Scale

  • SERP data collection at scale and why efficiency matters
  • Why Page One SERP data is no longer enough
  • Why pagination logic becomes operational debt
  • Why SERP data costs exploded

What is web scraping used for?

  • What is web scraping used for?
  • Pricing Intelligence Web Scraping
  • Web Scraping For Market Research
  • Use web scraping to build a data-driven product
  • Use web scraping for alternative data for finance
  • Use web scraping for brand monitoring
  • Use web scraping to automate MAP compliance
  • Web Scraping For Lead Generation
  • Web Scraping For Recruitment
  • Use web scraping for business automation
  • Using Data Extraction Tools for Efficient Website Scraping
  • Why Might a Business Use Web Scraping to Collect Data?
  • How to Scrape Images from Any Website: A Complete Guide
  • How to Scrape Search Engine Results

The New Guide to Web Scraping at Scale

  • Introduction
  • 1. A plan is a pathway to success
  • 2. Get serious about legal compliance
  • 3. The quality of your web data is of utmost importance
  • 4. Scaling and maintaining crawling and extracting solutions
  • 5. Adding AI to the web scraping stack
  • 6. The In-house vs outsourced question
  • 7. Questions to ask when scaling web scraping

Essential Web Scraping Techniques

  • TLS Fingerprint and how it blocks requests
  • How to scrape with a browser effectively
  • API First data extraction

More learn articles

Keep learning

All learn articles →
What are residential proxies bannerUse case

What is a residential proxy?

Learn what residential proxies are, how they compare to datacenter proxies, and why modern web scraping needs more than IP diversity.

10 min read

Zyte Case Studies — every customer story, in one placeUse case

How much do rotating proxies cost?

Learn how much rotating proxies cost, what affects pricing, and why total web scraping costs often go beyond proxy subscriptions.

10 min read

Zyte Case Studies — every customer story, in one placeUse case

How do rotating proxies work?

Learn how rotating proxies work, when to use them for web scraping, and why IP rotation alone is not enough for reliable data access.

10 min read

Services

Zyte Data

Coding tools & hacks straight to your inbox. Bi-weekly dosage of all things code.

Explore Zyte Data

Web Scraping API

Zyte API

Coding tools & hacks straight to your inbox. Bi-weekly dosage of all things code.

Sign Up

Developers

Zyte Developers

Coding tools & hacks straight to your inbox. Bi-weekly dosage of all things code.

Join Us
    • Zyte API
    • Ban Handling
    • AI Extraction
    • SERP
    • Enterprise
    • Scrapy Cloud
    • Agentic Web Data
    • Pricing
    • Product & E-commerce
    • Data for AI
    • Job Posting
    • Real Estate
    • News & Articles
    • Search
    • Social Media
    • Blog
    • Learn
    • Case Studies
    • Webinars
    • White Papers
    • Join our community
    • Documentation
    • Meet Zyte
    • Contact us
    • Jobs
    • Support
    • Terms and Policies
    • Trust Center
    • Do not sell
    • Cookie settings
    • Web Data Compliance
    • Open Source
    • What is Web Scraping
    • Web Scraping in Python: Ultimate Guide
    • Stop getting blocked, start scraping
  • EWDCI logoMost loved workplace certificateZyte rewardISO 27001 iconG2 rewardG2 rewardG2 reward
    XFacebookInstagramYouTubeLinkedInDiscord

    © Zyte Group Limited 2026