万本电子书0元读

万本电子书0元读

顶部广告

Go Web Scraping Quick Start Guide电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Vincent Smith

出  版  社:Packt Publishing

出版时间:2019-01-30

字       数:14.9万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
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.
目录展开

Title Page

Copyright and Credits

Go Web Scraping Quick Start Guide

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Get in touch

Reviews

Introducing Web Scraping and Go

What is web scraping?

Why do you need a web scraper?

Search engines

Price comparison

Building datasets

What is Go?

Why is Go a good fit for web scraping?

Go is fast

Go is safe

Go is simple

How to set up a Go development environment

Go language and tools

Git

Editor

Summary

The Request/Response Cycle

What do HTTP requests look like?

HTTP request methods

HTTP headers

Query parameters

Request body

What do HTTP responses look like?

Status line

Response headers

Response body

What are HTTP status codes?

100–199 range

200–299 range

300–399 range

400–499 range

500–599 range

What do HTTP requests/responses look like in Go?

A simple request example

Summary

Web Scraping Etiquette

What is a robots.txt file?

What is a User-Agent string?

Example

How to throttle your scraper

How to use caching

Cache-Control

Expires

Etag

Caching content in Go

Summary

Parsing HTML

What is the HTML format?

Syntax

Structure

Searching using the strings package

Example – Counting links

Example – Doctype check

Searching using the regexp package

Example – Finding links

Example – Finding prices

Searching using XPath queries

Example – Daily deals

Example – Collecting products

Searching using Cascading Style Sheets selectors

Example – Daily deals

Example – Collecting products

Summary

Web Scraping Navigation

Following links

Example – Daily deals

Submitting forms

Example – Submitting searches

Example – POST method

Avoiding loops

Breadth-first versus depth-first crawling

Depth-first

Breadth-first

Navigating with JavaScript

Example – Book reviews

Summary

Protecting Your Web Scraper

Virtual private servers

Proxies

Public and shared proxies

Dedicated proxies

Price

Location

Type

Anonymity

Proxies in Go

Virtual private networks

Boundaries

Whitelists

Blacklists

Summary

Scraping with Concurrency

What is concurrency

Concurrency pitfalls

Race conditions

Deadlocks

The Go concurrency model

Goroutines

Channels

sync package helpers

Conditions

Atomic counters

Summary

Scraping at 100x

Components of a web scraping system

Queue

Cache

Storage

Logs

Scraping HTML pages with colly

Scraping JavaScript pages with chrome-protocol

Example – Amazon Daily Deals

Distributed scraping with dataflowkit

The Fetch service

The Parse service

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部