TODO: 正则Regexp 获取Tags错误

This commit is contained in:
eson
2020-07-15 19:23:45 +08:00
parent b63e180499
commit 13ae890171
5 changed files with 62 additions and 40 deletions

2
extractor/openrec/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.html
screenlog.*

View File

@@ -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})