This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

update data && fix api text

  • Loading branch information...
sundy-li committed Jan 8, 2018
1 parent 8e9b944 commit d57be6954601012b7435cbf314af657634f346fd
Showing with 4 additions and 3 deletions.
  1. +4 −3 api.go
  2. BIN questions.data
View
7 api.go
@@ -1,10 +1,11 @@
package wechat_brain
import (
"io/ioutil"
"net/http"
"net/url"
"strings"
"github.com/PuerkitoBio/goquery"
)
var (
@@ -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)
}
View
Binary file not shown.

0 comments on commit d57be69

Please sign in to comment.