make a couple of changes pr:43

This commit is contained in:
vanilla 2021-09-09 11:15:53 +08:00
parent d3057f34fb
commit 7e61608f79
3 changed files with 68 additions and 45 deletions

6
api.go
View file

@ -34,9 +34,9 @@ func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error {
req.Header.Set("X-Guest-Token", s.guestToken)
// use cookie
if len(s.Cookie) > 0 && len(s.XCsrfToken) > 0 {
req.Header.Set("Cookie", s.Cookie)
req.Header.Set("x-csrf-token", s.XCsrfToken)
if len(s.cookie) > 0 && len(s.xCsrfToken) > 0 {
req.Header.Set("Cookie", s.cookie)
req.Header.Set("x-csrf-token", s.xCsrfToken)
}
resp, err := s.client.Do(req)