Go Web Scraping Quick Start Guide: Implement the power of Go to scrape and crawl data from the web

Vincent Smith

商品描述

Learn how some Go-specific language features help to simplify building web scrapers along with common pitfalls and best practices regarding web scraping.

Key Features

  • Use Go libraries like Goquery and Colly to scrape the web
  • Common pitfalls and best practices to effectively scrape and crawl
  • Learn how to scrape using the Go concurrency model

Book Description

Web scraping is the process of extracting information from the web using various tools that perform scraping and crawling. Go is emerging as the language of choice for scraping using a variety of libraries. This book will quickly explain to you, how to scrape data data from various websites using Go libraries such as Colly and Goquery.

The book starts with an introduction to the use cases of building a web scraper and the main features of the Go programming language, along with setting up a Go environment. It then moves on to HTTP requests and responses and talks about how Go handles them. You will also learn about a number of basic web scraping etiquettes.

You will be taught how to navigate through a website, using a breadth-first and then a depth-first search, as well as find and follow links. You will get to know about the ways to track history in order to avoid loops and to protect your web scraper using proxies.

Finally the book will cover the Go concurrency model, and how to run scrapers in parallel, along with large-scale distributed web scraping.

What you will learn

  • Implement Cache-Control to avoid unnecessary network calls
  • Coordinate concurrent scrapers
  • Design a custom, larger-scale scraping system
  • Scrape basic HTML pages with Colly and JavaScript pages with chromedp
  • Discover how to search using the "strings" and "regexp" packages
  • Set up a Go development environment
  • Retrieve information from an HTML document
  • Protect your web scraper from being blocked by using proxies
  • Control web browsers to scrape JavaScript sites

Who this book is for

Data scientists, and web developers with a basic knowledge of Golang wanting to collect web data and analyze them for effective reporting and visualization.

Table of Contents

  1. Introducing Web Scraping and Go
  2. The Request/Response Cycle
  3. Web Scraping Etiquette
  4. Parsing HTML
  5. Web Scraping Navigation
  6. Protecting Your Web Scraper
  7. Scraping with Concurrency
  8. Scraping at 100x

商品描述(中文翻譯)

學習如何使用一些Go特定的語言功能來簡化建立網頁爬蟲,以及關於網頁爬取的常見問題和最佳實踐。

主要特點:
- 使用Go的庫,如Goquery和Colly,來爬取網頁
- 有效地爬取和抓取的常見問題和最佳實踐
- 學習如何使用Go的並發模型進行爬取

書籍描述:
網頁爬取是使用各種工具從網頁中提取信息的過程。Go正成為使用各種庫進行爬取的首選語言。本書將快速向您解釋如何使用Colly和Goquery等Go庫從各種網站中爬取數據。

本書首先介紹了構建網頁爬蟲的用例和Go編程語言的主要特點,以及如何設置Go環境。然後介紹了HTTP請求和響應,以及Go如何處理它們。您還將了解一些基本的網頁爬取禮儀。

您將學習如何通過廣度優先搜索和深度優先搜索來導航網站,以及查找和跟踪鏈接的方法。您還將了解如何跟踪歷史記錄以避免循環,並使用代理保護您的網頁爬蟲。

最後,本書將介紹Go的並發模型,以及如何並行運行爬蟲,以及大規模分佈式網頁爬取。

您將學到什麼:
- 實施Cache-Control以避免不必要的網絡請求
- 協調並發爬蟲
- 設計自定義的大規模爬取系統
- 使用Colly爬取基本的HTML頁面,使用chromedp爬取JavaScript頁面
- 發現如何使用'strings'和'regexp'包進行搜索
- 設置Go開發環境
- 從HTML文檔中檢索信息
- 使用代理保護您的網頁爬蟲
- 控制網絡瀏覽器以爬取JavaScript網站

本書適合對Golang有基本知識的數據科學家和網絡開發人員,他們希望收集網絡數據並對其進行有效的報告和可視化分析。

目錄:
1. 介紹網頁爬取和Go
2. 請求/響應循環
3. 網頁爬取禮儀
4. 解析HTML
5. 網頁爬取導航
6. 保護您的網頁爬蟲
7. 並發爬取
8. 100倍速度的爬取