Project Structure
We have seen the basic structure of a browser-based scraper. It is now time to turn that example into a complete Chrome extension that we can configure and control without modifying the scraper's source code for every website.
The project we are going to build consists of six main files:
manifest.json— the extension's configuration file. It tells Chrome how the extension is structured, which permissions it needs, and which files should be loaded.menu.html— the HTML for the extension popup. This will contain the controls we use to interact with the scraper.menu.css— the styling for the popup interface.menu.js— the middleware between the extension interface and the target page. It will handle communication between the popup and the scripts running on the scraped website.ui.js— the user interface logic. It will handle all the extension logic on the target website.scraper.js— the main scraping logic. This is responsible for discovering listing URLs, navigating through pages, extracting data, and maintaining the scraper's state.
The relationship between these files is important. The popup provides the controls, the middleware allows the popup to communicate with the page, the page UI provides tools for configuring the scraper, and the scraper itself performs the actual crawling and extraction.
Building It File by File
Rather than presenting the entire extension as one large piece of code, we will build it gradually. We will walk through the source code file by file and see how each part contributes to the complete system.
This approach also makes the architecture easier to understand. Every file has a specific responsibility, and as we add functionality we will see how those responsibilities connect together.
Where We Are Going
We will start with a very simple website designed specifically for learning web scraping: quotes.to.scrape.com. This gives us a controlled environment where we can concentrate on the extension itself without immediately dealing with the complexity of a real-world website.
Once the extension works there, we will take the same system to a real-world real estate website and use it to collect actual property data. This will give us an opportunity to see how the ideas developed throughout the book apply to a much more realistic scraping task.
By the end of the project, we will have gone from a small hard-coded browser scraper to a reusable Chrome extension with a user interface, visual selectors, persistent scraper state, navigation logic, and data collection capabilities.
From this point onward, we are no longer just discussing browser-based scraping as an idea. We are going to build the complete extension, one file at a time, and use it first on a simple practice website and then on a real-world real estate website.