3

Searching and Processing Web Documents

So far, we have learned about web scraping, data-finding techniques, and related technologies that help us with scraping, and we’ve identified a few reasons to select the Python programming language.

Web- or website-based content exists as HTML elements or as a predefined document or some kind of object (JSON). For extraction purposes, we need to analyze and identify such content, patterns, and objects. HTML-based elements are generally identified with XML Path (XPath) and Cascading Style Sheets (CSS) selectors, which are traversed and processed with scraping logic for the desired content. The lxml library will be used in this chapter to process markup documents. We will be using browser-based Developer ...

Get Hands-On Web Scraping with Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.