Skip to content

Commit

Permalink
update get user api
Browse files Browse the repository at this point in the history
  • Loading branch information
juzeon committed Oct 16, 2024
1 parent bc25229 commit df73af3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sydney/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ func (o *Sydney) GetUser() (string, error) {
}
resp, err := client.R().
SetHeader("Cookie", util.FormatCookieString(cookies)).
Get("https://www.bing.com/search?q=Bing+AI&showconv=1")
Get("https://edgeservices.bing.com/edgesvc/chat")
if err != nil {
return "", err
}
if resp.GetStatusCode() != 200 {
return "", errors.New("http status code is not 200: " + strconv.Itoa(resp.GetStatusCode()))
}
respText := resp.String()
arr := regexp.MustCompile(`data-clarity-mask="true" title="(.*?)"`).FindStringSubmatch(respText)
arr := regexp.MustCompile(`initUserStatus.*?"Name":"(.*?)"`).FindStringSubmatch(respText)
if len(arr) < 2 {
return "", errors.New("cannot identify current user, please check if cookie is expired")
}
Expand Down

0 comments on commit df73af3

Please # to comment.