Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

6 Commits

Repository files navigation

GABAHTMLParser

A Simple HTML Parser.

Installation

go get github.com/HarrisonKawagoe3960X/GABAHTMLParser

Usage

Import the GABAHTMLParser

Just add "github.com/HarrisonKawagoe3960X/GABAHTMLParser" into import like this:

package main
import(
"fmt""github.com/HarrisonKawagoe3960X/GABAHTMLParser"//Add this
)
funcmain() {
htmlobject:=GABAHTMLParser.GetHTMLfromURL("someurl",false)
results:=htmlobject.Find("tag = 'a'")
for_ , result:=rangeresults{
fmt.Println(result.InnerHTML)
}
}

Parse HTML from URL or path

htmlobject:=GABAHTMLParser.GetHTMLfromURL("someurl",false)

if you parse the source of site that use Shift-JIS encoding, change false to true

htmlobject:=GABAHTMLParser.GetHTMLfromURL("someurl",true)

Parse HTML from String Array

htmlobject:=GABAHTMLParser.ParseHTML(strarray)

Element Object

After parsing the HTML, you can extract the data by calling Element.

  • InnerHTML: HTML code under the current HTML Element.
  • Tag: Tag name of current HTML Element.
  • Child: Child Objects of current HTML Element.
  • Parent: Parent Object of current HTML Element.
  • Attr: Properties of current HTML Element.

Search for HTML Object

results:=htmlobject.Find("tag = 'a'")

you can combine conditions by using &&

results:=htmlobject.Find("tag = 'a' && class = 'hanshin'")

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages