1.修改build.sh

2.删除hunter包引用和使用
This commit is contained in:
eson
2020-08-17 14:38:00 +08:00
parent d1298dc3f3
commit 9d7c2e1e54
8 changed files with 12 additions and 128 deletions

View File

@@ -7,7 +7,6 @@ import (
"testing"
"time"
"github.com/474420502/hunter"
"github.com/lestrrat-go/libxml2"
)
@@ -91,28 +90,6 @@ func TestCase(t *testing.T) {
t.Error(xr)
}
func TestUserName(t *testing.T) {
f, err := os.Open("test.html")
if err != nil {
panic(err)
}
data, err := ioutil.ReadAll(f)
if err != nil {
panic(err)
}
extractor := hunter.NewExtractor(data)
xp, err := extractor.XPathResult("//p[ contains(@class, 'c-global__user__profile__list__name__text')]/text()")
if err != nil {
t.Error(err)
} else {
if xp.NodeIter().Next() {
userName := xp.String()
t.Error(userName)
}
}
}
func TestExtractor(t *testing.T) {
Execute()
}