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

Commit

Permalink
update data && fix api text
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Jan 8, 2018
1 parent 8e9b944 commit d57be69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package wechat_brain

import (
"io/ioutil"
"net/http"
"net/url"
"strings"

"github.com/PuerkitoBio/goquery"
)

var (
Expand All @@ -27,9 +28,9 @@ func GetFromApi(req *http.Request, quiz string, options []string) (res map[strin
if resp == nil {
return
}
bs, _ := ioutil.ReadAll(resp.Body)
doc, _ := goquery.NewDocumentFromReader(resp.Body)
defer resp.Body.Close()
str := string(bs)
str := doc.Find("#content_left .result").Text()
for _, option := range options {
res[option] = strings.Count(str, option)
}
Expand Down
Binary file modified questions.data
Binary file not shown.

0 comments on commit d57be69

Please sign in to comment.