TODO: 正则Regexp 获取Tags错误
This commit is contained in:
2
extractor/openrec/.gitignore
vendored
Normal file
2
extractor/openrec/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.html
|
||||
screenlog.*
|
||||
@@ -96,6 +96,10 @@ func TestExtractor(t *testing.T) {
|
||||
collect := intimate.NewExtractorStore()
|
||||
store := intimate.NewSourceStore("source_openrec")
|
||||
source, err := store.Pop(string(intimate.TTOpenrecRanking), 100)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
anchorId := source.GetSource().String
|
||||
|
||||
@@ -180,11 +184,11 @@ func TestExtractor(t *testing.T) {
|
||||
// MovieToolbar__Views-g5e6ic-13 iDRGyA
|
||||
livejson := m["user_live"]
|
||||
|
||||
// f, err := os.OpenFile("./test.html", os.O_CREATE|os.O_TRUNC|os.O_RDWR, os.ModePerm)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// f.WriteString(livejson.String())
|
||||
f, err := os.OpenFile("./test.html", os.O_CREATE|os.O_TRUNC|os.O_RDWR, os.ModePerm)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
f.WriteString(livejson.String())
|
||||
|
||||
extractor = hunter.NewExtractor([]byte(livejson.Str))
|
||||
// xr, err := extractor.XPathResult("//h1[ contains(@class, 'MovieTitle__Title')]")
|
||||
@@ -228,6 +232,9 @@ func TestExtractor(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
matheslist := regexp.MustCompile(`TagButton__Button.+>([^<]+)<`).FindAllStringSubmatch(livejson.Str, 0)
|
||||
t.Error(matheslist)
|
||||
|
||||
LiveUrl := "https://www.openrec.tv/live/" + anchorId
|
||||
ai.SetLiveUrl(sql.NullString{String: LiveUrl, Valid: true})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user