Web Scraping with Python cover

Web Scraping with Python

No rating yet
Word count
280 words
Chapters
1
Series
Web Scraping with Python: Collecting Data from the Modern Web
ISBN
9787115416292

Tags

Summary

Web Scraping with Python: Collecting Data from the Modern Web is an introductory book on web scraping techniques written by Ryan Mitchell and translated by Tao Junjie and Chen Xiaoli. Published in 2016 by Posts & Telecom Press as part of its Turing Programming Series, it is based on the original English edition from O'Reilly Media. The book is divided into two parts, with 14 chapters and 3 appendices. Part One, "Building Scrapers," covers the fundamentals of data collection: starting with sending requests to servers using urllib, it explains how to use BeautifulSoup for parsing and navigating the parse tree, regular expressions and lambda expressions, traversing a single domain and recursive scraping of an entire site, and also introduces the Scrapy framework. It then covers the basic concepts and calling conventions of APIs (Echo Nest, Twitter, Google, and others), JSON parsing, and methods for storing data in files, CSV, and MySQL, along with demonstrations of reading data from encoded text, CSV, PDF, Word, and other documents. Part Two, "Advanced Scraping," confronts practical difficulties: cleaning dirty data with OpenRefine and Python, basic natural language processing with NLTK; handling form submission, login, and cookies with Requests; dealing with JavaScript-rendered pages using Selenium (and PhantomJS at the time); processing text in images with Pillow and OCR techniques, and discussing how to circumvent anti-scraping mechanisms such as CAPTCHAs; finally, website automation testing with unit tests and Selenium, and remote scraping via proxy servers and Tor. Appendices A, B, and C introduce Python, internet fundamentals, and the legal and ethical constraints of web scraping, respectively. The book is compact (about 200 pages, 280,000 characters), focusing on building an overall knowledge map and providing runnable examples rather than delving into advanced performance topics such as concurrency and clustering. The author also reminds readers: before scraping, one should understand the robots protocol and relevant laws, and respect website rights and user privacy.

Editor's review

如果你想从「会写 Python」跨到「能用 Python 把网上的数据弄下来」,这本书是性价比很高的起点。它不追求工具大全,而是按真实工作流展开:先发请求、再解析 HTML、然后遍历站点、调用 API、存储数据,最后处理脏数据和登录、JavaScript、验证码这些最容易卡住人的环节。每章都配示例代码,读完能立刻改造成自己项目里的脚本。 更难得的是,作者是真正做过爬虫项目的一线工程师,讲得实在:什么时候该用 API 而不是硬爬、HTML 结构变了怎么办、数据存 CSV 还是数据库、requests 与 Selenium 各管什么。附录还专门讨论法律与道德约束,提醒读者在动手之前先想清楚边界,这在同类书里并不多见。 需要提醒的是,本书 2016 年出版,书中不少工具与网站接口已发生变化(如 Twitter API、PhantomJS 已弃用),部分示例需要按新版文档调整。把它当作建立知识框架和思路的读物,而不是逐字照抄的代码手册,收获会更大;追求更新的读者可以再对照同书的第 2 版。

Who it's for

A good fit for

  • 有 Python 基础语法、想系统入门网络爬虫的开发者
  • 需要批量收集网页数据做分析的数据分析人员与科研人员
  • 想了解网站常被采集方式与防护思路的运维、安全从业者
  • 做数据类课程设计或小项目、需要一本可上手参考书的学生

Not a good fit for

  • 完全没有编程经验、需要从零学 Python 的读者
  • 只想找现成「一键采集」工具、不打算写代码的人
  • 需要大规模分布式爬虫与高性能并发架构的进阶读者
  • 要求示例代码与当前最新接口完全一致的读者

Reading tips

  1. 边读边敲:每章示例都在本地跑一遍,比只看书更容易发现环境与版本差异。
  2. 按两条主线阅读:先吃透第一部分(请求、解析、遍历、存储),再按需翻第二部分对应章节。
  3. 遇到接口或库已更新时,以官方文档为准修改示例,把它当成练习排查问题的机会。
  4. 动手前先读附录 C 与 robots 协议,确认目标站点条款,控制访问频率并遵守相关法规。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Turing Programming Series

FAQ

这本书和《Python网络数据采集》第2版有什么区别?
第1版 2016 年出版,据英文原版 2015 年版译出;第2版由同一译者团队翻译、内容与代码有所更新,并修订了部分过时工具与接口。版本信息以图书版权页和出版社官方页面为准。
没有学过 Python 能读懂吗?
书中附录 A 有 Python 简介,但篇幅有限,主体默认读者会基本语法与模块概念。零基础建议先补一门 Python 入门课,再回来看本书会更顺畅。
书里的爬虫代码现在还能直接跑吗?
大部分思路仍适用,但部分网站 API、浏览器驱动和工具生态已变化。建议按当前库版本调整调用方式,遇到报错优先查官方文档与更新日志。
学爬虫需要担心法律问题吗?
需要。书中附录 C 讨论了相关法律与道德约束。实践中应遵守目标网站服务条款与 robots 协议,不采集个人隐私数据,控制请求频率,避免对站点造成负担。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category