Skip to content
This repository was archived by the owner on Aug 2, 2018. It is now read-only.

Commit d57be69

Browse files
committed
update data && fix api text
1 parent 8e9b944 commit d57be69

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

api.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package wechat_brain
22

33
import (
4-
"io/ioutil"
54
"net/http"
65
"net/url"
76
"strings"
7+
8+
"github.com/PuerkitoBio/goquery"
89
)
910

1011
var (
@@ -27,9 +28,9 @@ func GetFromApi(req *http.Request, quiz string, options []string) (res map[strin
2728
if resp == nil {
2829
return
2930
}
30-
bs, _ := ioutil.ReadAll(resp.Body)
31+
doc, _ := goquery.NewDocumentFromReader(resp.Body)
3132
defer resp.Body.Close()
32-
str := string(bs)
33+
str := doc.Find("#content_left .result").Text()
3334
for _, option := range options {
3435
res[option] = strings.Count(str, option)
3536
}

questions.data

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)