Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Go Web Scraping Quick Start Guide

You're reading from   Go Web Scraping Quick Start Guide Implement the power of Go to scrape and crawl data from the web

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781789615708
Length 132 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Vincent Smith Vincent Smith
Author Profile Icon Vincent Smith
Vincent Smith
Arrow right icon
View More author details
Toc

Scraping HTML pages with colly

colly is one of the available projects on GitHub that covers most of the systems discussed earlier. This project is built to run on a single machine, due to its reliance on a local cache and queuing system.

The main worker object in colly, the Collector, is built to run in its own goroutine, allowing you to run multiple Collectors simultaneously. This design offers you the ability to scrape from multiple sites at the same time with different parameters, such as crawl delays, white and blacklists, and proxies.

colly is built to only process HTML and XML files. It does not offer support for JavaScript execution. However, you would be surprised at how much information you can collect with pure HTML. The following example is adapted from the GitHub README:

package main

import (
"github.com/gocolly/colly"
"fmt"
)

func main() {
c ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime