Skip to content

Commit

Permalink
[Fix] 🐛 BingAPI Request Throttled Error Handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-zklcdc committed Jan 31, 2024
1 parent a740476 commit 85bb16c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/v1/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func ChatHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("\n\n"))
flusher.Flush()

if tmp == "User needs to solve CAPTCHA to continue." && common.BypassServer != "" && r.Header.Get("Cookie") == "" {
if (tmp == "User needs to solve CAPTCHA to continue." || tmp == "Request is throttled." || tmp == "Unknown error.") && common.BypassServer != "" && r.Header.Get("Cookie") == "" {
go func(cookie string) {
t, _ := getCookie(cookie, chat.GetChatHub().GetConversationId(), hex.NewUUID())
if t != "" {
Expand Down Expand Up @@ -178,7 +178,7 @@ func ChatHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write(resData)

if text == "User needs to solve CAPTCHA to continue." && common.BypassServer != "" && r.Header.Get("Cookie") == "" {
if (text == "User needs to solve CAPTCHA to continue." || text == "Request is throttled." || text == "Unknown error.") && common.BypassServer != "" && r.Header.Get("Cookie") == "" {
go func(cookie string) {
t, _ := getCookie(cookie, chat.GetChatHub().GetConversationId(), hex.NewUUID())
if t != "" {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.4
toolchain go1.21.6

require (
github.com/Harry-zklcdc/bing-lib v1.3.0
github.com/Harry-zklcdc/bing-lib v1.3.2
github.com/andybalholm/brotli v1.1.0
github.com/refraction-networking/utls v1.6.1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Harry-zklcdc/bing-lib v1.3.0 h1:kVA8EizoDFNrohRVWBSVlOXabstwK3p8mOzZQKKZKiU=
github.com/Harry-zklcdc/bing-lib v1.3.0/go.mod h1:Ruq9Ka/DqdYpKrX0vPUKikH3hn8RDZ8F+rAePRSyKAg=
github.com/Harry-zklcdc/bing-lib v1.3.2 h1:1qdWdK/sAufnha//ZFwW4w4Kq7XqBm+4cQir3/nPmJI=
github.com/Harry-zklcdc/bing-lib v1.3.2/go.mod h1:Ruq9Ka/DqdYpKrX0vPUKikH3hn8RDZ8F+rAePRSyKAg=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
Expand Down

0 comments on commit 85bb16c

Please sign in to comment.