Python Web Scraping Cookbook: Over 90 proven recipes to get you scraping with Python, micro services, Docker and AWS

Michael Heydt



Untangle your web scraping complexities and access web data with ease using Python scripts

Key Features

  • Hands-on recipes for advancing your web scraping skills to expert level.
  • One-Stop Solution Guide to address complex and challenging web scraping tasks using Python.
  • Understand the web page structure and collect meaningful data from the website with ease

Book Description

Python Web Scraping Cookbook is a solution-focused book that will teach you techniques to develop high-performance scrapers and deal with crawlers, sitemaps, forms automation,

Ajax-based sites, caches, and more.You'll explore a number of real-world scenarios where every part of the development/product life cycle will be fully covered. You will not only develop the skills to design and develop reliable, performance data flows, but also deploy your codebase to an AWS. If you are involved in software engineering, product development, or data mining (or are interested in building data-driven products), you will find this book useful as each recipe has a clear purpose and objective.

Right from extracting data from the websites to writing a sophisticated web crawler, the book's independent recipes will be a godsend on the job. This book covers Python libraries, requests, and BeautifulSoup. You will learn about crawling, web spidering, working with AJAX websites, paginated items, and more. You will also learn to tackle problems such as 403 errors, working with proxy, scraping images, LXML, and more.

By the end of this book, you will be able to scrape websites more efficiently and to be able to deploy and operate your scraper in the cloud.

What you will learn

  • Use a wide variety of tools to scrape any website and data-including BeautifulSoup, Scrapy, Selenium, and many more
  • Master expression languages such as XPath, CSS, and regular expressions to extract web data
  • Deal with scraping traps such as hidden form fields, throttling, pagination, and different status codes
  • Build robust scraping pipelines with SQS and RabbitMQ
  • Scrape assets such as images media and know what to do when Scraper fails to run
  • Explore ETL techniques of build a customized crawler, parser, and convert structured and unstructured data from websites
  • Deploy and run your scraper-as-aservice in AWS Elastic Container Service

Who This Book Is For

This book is ideal for Python programmers, web administrators, security professionals or someone who wants to perform web analytics would find this book relevant and useful. Familiarity with Python and basic understanding of web scraping would be useful to take full advantage of this book.

Table of Contents

  1. Getting started with Scraping
  2. Data acquisition and extraction
  3. Processing Data
  4. Working with images, audio and other assets
  5. Scraping - Code of Conduct
  6. Scraping Challenges and Solutions
  7. Text Wrangling and Analysis
  8. Searching, mining and visualizing data
  9. Working with an API and Providing a Data API
  10. Creating scraper microservices with Docker
  11. A complete real world example




- 實踐提升網絡爬蟲技能至專家級的實用食譜。
- 一站式解決方案指南,以Python應對複雜且具有挑戰性的網絡爬蟲任務。
- 瞭解網頁結構,輕鬆從網站收集有意義的數據。






- 使用各種工具(包括BeautifulSoup、Scrapy、Selenium等)來爬取任何網站和數據。
- 掌握XPath、CSS和正則表達式等表達語言,以提取網絡數據。
- 處理隱藏表單字段、限流、分頁和不同的狀態碼等爬取陷阱。
- 使用SQS和RabbitMQ構建強大的爬取流水線。
- 爬取圖片、媒體等資源,並在爬蟲運行失敗時採取相應措施。
- 探索ETL技術,構建定制的爬蟲、解析器,並從網站中轉換結構化和非結構化數據。
- 在AWS Elastic Container Service中部署和運行您的爬蟲作為服務。




1. 開始爬取
2. 數據獲取和提取
3. 數據處理
4. 處理圖片、音頻和其他資源
5. 爬取 - 行為準則
6. 爬取挑戰和解決方案
7. 文本整理和分析
8. 搜索、挖掘和可視化數據
9. 使用API並提供數據API
10. 使用Docker創建爬蟲微服務
11. 完整的實際案例