README
¶
Surf
Surf is a Go (golang) library that implements a virtual web browser that you control programmatically. Surf isn't just another Go solution for downloading content from the web. Surf is designed to behave like web browser, and includes: cookie management, history, bookmarking, user agent spoofing (with a nifty user agent builder), submitting forms, DOM selection and traversal via jQuery style CSS selectors, scraping assets like images, stylesheets, and other features.
Installation
Download the library using go.
go get gopkg.in/headzoo/surf.v1
Import the library into your project.
import "gopkg.in/headzoo/surf.v1"
Quick Start
package main
import (
"gopkg.in/headzoo/surf.v1"
"fmt"
)
func main() {
bow := surf.NewBrowser()
err := bow.Open("http://golang.org")
if err != nil {
panic(err)
}
// Outputs: "The Go Programming Language"
fmt.Println(bow.Title())
}
Documentation
Complete documentation is available on Read the Docs.
Credits
Surf uses the awesome goquery by Martin Angers, and was written using Intellij and the golang plugin.
Contributions have been made to Surf by the following awesome developers:
- Sean Hickey
- Haruyama Seigo
- Tatsushi Demachi
- Charl Matthee
- Matt Holt
- lalyos
- lestrrat
- Carl Henrik Lunde
- cornerot
- lennyxc
- tlianza
- joshuamorris3
- sqs
- nicot
- Joseph Watson
- lxt2
The idea to create Surf was born in this Reddit thread.
Contributing
Issues and pull requests are always welcome.
See CONTRIBUTING.md for more information.
License
Surf is released open source software released under The MIT License (MIT). See LICENSE.md for more information.
Documentation
¶
Overview ¶
Package surf ensembles other packages into a usable browser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultUserAgent is the global user agent value. DefaultUserAgent = agent.Create() // DefaultSendReferer is the global value for the AttributeSendReferer attribute. DefaultSendReferer = true // DefaultMetaRefreshHandling is the global value for the AttributeHandleRefresh attribute. DefaultMetaRefreshHandling = true // DefaultFollowRedirects is the global value for the AttributeFollowRedirects attribute. DefaultFollowRedirects = true // DefaultMaxHistoryLength is the global value for max history length. DefaultMaxHistoryLength = 0 )
Functions ¶
func NewBrowser ¶
NewBrowser creates and returns a *browser.Browser type.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package agent generates user agents strings for well known browsers and for custom browsers.
|
Package agent generates user agents strings for well known browsers and for custom browsers. |
Package browser contains the primary browser implementation.
|
Package browser contains the primary browser implementation. |
Package errors contains error types specific to the Surf library.
|
Package errors contains error types specific to the Surf library. |
Package jar has containers for storing data, such as bookmarks and cookies.
|
Package jar has containers for storing data, such as bookmarks and cookies. |
Package util contains some utility methods used by other packages.
|
Package util contains some utility methods used by other packages. |