Discover Packages
github.com/jackdanger/Collectlinks
package
module
Version:
v0.0.0-...-24c4ee2
Opens a new window with list of versions in this module.
Published: Apr 21, 2016
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
Package collectlinks is useful for only one task:
Given a response from http.Get
it will use parse the page and
return to you a slice of all the href links found.
Usage:
package main
import (
"github.com/jackdanger/collectlinks"
"net/http"
"fmt"
)
func main() {
resp, _ := http.Get("http://motherfuckingwebsite.com")
links := collectlinks.All(resp.Body)
fmt.Println(links)
}
Running that will output:
[http://twitter.com/thebarrytone http://txti.es]
Expand ▾
Collapse ▴
Documentation
¶
Package collectlinks does extraordinarily simple operation of parsing a given piece of html
and providing you with all the hyperlinks hrefs it finds.
Package collectlinks is useful for only one task:
Given a response from http.Get it will use parse the page and
return to you a slice of all the href links found.
Usage:
package main
import (
"github.com/jackdanger/collectlinks"
"net/http"
"fmt"
)
func main() {
resp, _ := http.Get("http://motherfuckingwebsite.com")
links := collectlinks.All(resp.Body)
fmt.Println(links)
}
Running that will output:
[http://twitter.com/thebarrytone http://txti.es]
All takes a reader object (like the one returned from http.Get())
It returns a slice of strings representing the "href" attributes from
anchor links found in the provided html.
It does not close the reader passed to it.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.