1.修改build.sh
2.删除hunter包引用和使用
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user