package main import ( "io/ioutil" "os" "regexp" "testing" "time" "github.com/lestrrat-go/libxml2" ) func TestCase0(t *testing.T) { f, err := os.Open("./test.html") if err != nil { panic(err) } data, err := ioutil.ReadAll(f) if err != nil { panic(err) } matheslist := regexp.MustCompile(`TagButton__Button[^>]+>(.{1,100})" xresult, err := doc.Find("/html/head") ele, err := doc.CreateElement(`META`) if err != nil { panic(err) } ele.SetAttribute("charset", "utf-8") if err != nil { panic(err) } iter := xresult.NodeIter() if iter.Next() { n := iter.Node() err = n.AddChild(ele) // childs, err := n.ChildNodes() if err != nil { t.Error(err) } t.Error(n) } xr, err := doc.Find("//h1[ contains(@class, 'MovieTitle__Title')]") if err != nil { panic(nil) } t.Error(xr) } func TestExtractor(t *testing.T) { oe := &OpenrecExtractor{} oe.Execute() }