extract

package module
v0.0.0-...-679726a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2015 License: MIT Imports: 4 Imported by: 0

README

extract GoDoc

extract is a simple library for extracting elements from a web page. It provides simple higher level functions based upon Cascadia and html packages.

For example,

package main

import (
	"fmt"
	"log"

	"github.com/hariharan-uno/extract"
)

func main() {
	l, err := extract.Links("http://google.com")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(l)
}
extract all the URLs of the images from a web page
package main

import (
	"fmt"
	"log"

	"github.com/hariharan-uno/extract"
)

func main() {
	i, err := extract.Images("http://google.com")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(i)
}

Currently, only the functions extract.Links() and extract.Images() are supported. If you'd like a specific function to be supported, please file an issue.

Credits

Authors of Cascadia and html

Documentation

Overview

Package extract provides simple methods for extracting specific items from a web page.

Example
package main

import (
	"fmt"
	"log"

	"github.com/hariharan-uno/extract"
)

func main() {
	links, err := extract.Links("https://google.com")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", links)

	images, err := extract.Images("https://google.com")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", images)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Images

func Images(u string) ([]string, error)

Images returns the absolute URLs of all the images from an URL of a webpage.

func Links(u string) ([]string, error)

Links returns the absolute URLs of all references from an URL of a webpage.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL