Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steelx/extractlinks
extractlinks GO package for extracting anchor links from HTML
https://github.com/steelx/extractlinks
go golang
Last synced: 3 days ago
JSON representation
extractlinks GO package for extracting anchor links from HTML
- Host: GitHub
- URL: https://github.com/steelx/extractlinks
- Owner: steelx
- License: mit
- Created: 2019-11-14T12:20:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-04T18:53:20.000Z (almost 5 years ago)
- Last Synced: 2024-08-02T15:11:52.708Z (3 months ago)
- Topics: go, golang
- Language: Go
- Size: 14.6 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Actions Status](https://github.com/steelx/extractlinks/workflows/go/badge.svg)](https://github.com/steelx/extractlinks/actions)
# extractlinks
extractlinks GO package for extracting anchor links from HTMLExtracts all anchor links from a HTML page into an Array of `[]Link`
```
type Link struct {
Href string
Text string
}
```## Install
`go get -u github.com/steelx/extractlinks`## Example
```
package mainimport (
"fmt"
"net/http"
"github.com/steelx/extractlinks"
)func main() {
resp, _ := http.Get("http://www.youtube.com/JsFunc")
links, err := extractlinks.All(resp.Body)
checkErr(err)
fmt.Println(links)
}```
Output: (... is just to suppress rest of the result)
`[{/ IN} {//www.youtube.com/upload } {/channel/UCuB4FSBjofpagXnBlHQUocA } ...]`