-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathididom_test.go
50 lines (43 loc) · 1 KB
/
ididom_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package random
import (
"log"
"testing"
)
func TestIdidom(t *testing.T) {
r := New()
Use(DataIdidomChina)
for i := 0; i < 1000; i++ {
log.Println(r.Extend().Ididom())
}
}
// func estIdidom(t *testing.T) {
// u := "https://www.y5000.com/idiom/list-0-0-5.html"
// tp := requests.NewSession().Get(u)
// p := tp.PathParam("list-0-0-(\\d+)\\.")
// for i := int64(0); ; i++ {
// p.IntSet(i)
// resp, err := tp.Execute()
// if err != nil {
// panic(err)
// }
// etor := extractor.ExtractHtml(resp.Content())
// xps, err := etor.XPaths("//div[@class='iC-column']")
// if err != nil {
// panic(err)
// }
// lis, errs := xps.ForEach("//li")
// if len(errs) != 0 {
// panic(errs)
// }
// if lis == nil {
// log.Println("page:", i)
// break
// }
// ididomCollection := lis.ForEachObjectByTag(Ididom{})
// for _, ididom := range ididomCollection {
// i := ididom.(*Ididom)
// ididoms = append(ididoms, i)
// }
// }
// CompressData("ididom.gob.zst", ididoms)
// }