From 51fe6f6039fe0ac4a5f0c02b6736de146aaa7aa8 Mon Sep 17 00:00:00 2001 From: eson Date: Thu, 16 Jul 2020 11:02:30 +0800 Subject: [PATCH] =?UTF-8?q?finish:=20=E8=A7=A3=E6=9E=90=E9=80=BB=E8=BE=91,?= =?UTF-8?q?=20=E5=85=A5=E5=BA=93=E6=AD=A3=E7=A1=AE.=20TODO:=20=E6=95=B4?= =?UTF-8?q?=E7=90=86=E4=BB=A3=E7=A0=81,=20=E8=AE=A9=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E6=95=B0=E6=8D=AE=E6=88=90=E4=B8=BA=20?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=BA=93.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extractor/openrec/openrec_test.go | 32 +++++++++++++++++++++++--- extractor_field.go | 31 +++++++++++++------------- store.go | 37 +++++++++++-------------------- 3 files changed, 57 insertions(+), 43 deletions(-) diff --git a/extractor/openrec/openrec_test.go b/extractor/openrec/openrec_test.go index 33cb210..3c7eb9f 100644 --- a/extractor/openrec/openrec_test.go +++ b/extractor/openrec/openrec_test.go @@ -19,6 +19,20 @@ import ( "github.com/tidwall/gjson" ) +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})(.+)").FindStringSubmatch(livejson.Str) + mathes := regexp.MustCompile("MovieTitle__Title[^>]+>(.{1,50})").FindStringSubmatch(livejson.Str) if len(mathes) == 2 { clog.SetShowTitle(sql.NullString{String: mathes[1], Valid: true}) @@ -232,8 +246,19 @@ func TestExtractor(t *testing.T) { } } - matheslist := regexp.MustCompile(`TagButton__Button.+>([^<]+)<`).FindAllStringSubmatch(livejson.Str, 0) - t.Error(matheslist) + var tags []string + matheslist := regexp.MustCompile(`TagButton__Button[^>]+>(.{1,100})