From 19ceea97102d7bff1eaa4dfe275aadee3edf8c24 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Sat, 22 Jun 2024 10:02:58 +0000 Subject: [PATCH] update --- au/Binge.go | 5 +++-- au/Channel9.go | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/au/Binge.go b/au/Binge.go index 40d01bb..8685687 100644 --- a/au/Binge.go +++ b/au/Binge.go @@ -2,9 +2,10 @@ package au import ( "fmt" + "net/http" + "github.com/oneclickvirt/UnlockTests/model" "github.com/oneclickvirt/UnlockTests/utils" - "net/http" ) // Binge @@ -30,7 +31,7 @@ func Binge(c *http.Client) model.Result { if resp.StatusCode == 403 || resp.StatusCode == 451 { return model.Result{Name: name, Status: model.StatusNo} } - if resp.StatusCode == 302 { + if resp.StatusCode == 302 || resp.StatusCode == 200 { return model.Result{Name: name, Status: model.StatusYes} } return model.Result{Name: name, Status: model.StatusUnexpected, diff --git a/au/Channel9.go b/au/Channel9.go index 2437c3c..54ba40e 100644 --- a/au/Channel9.go +++ b/au/Channel9.go @@ -2,9 +2,12 @@ package au import ( "fmt" + "io" + "net/http" + "strings" + "github.com/oneclickvirt/UnlockTests/model" "github.com/oneclickvirt/UnlockTests/utils" - "net/http" ) // Channel9 @@ -21,15 +24,15 @@ func Channel9(c *http.Client) model.Result { return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err} } defer resp.Body.Close() - //b, err := io.ReadAll(resp.Body) - //if err != nil { - // return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")} - //} - //body := string(b) + b, err := io.ReadAll(resp.Body) + if err != nil { + return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")} + } + body := string(b) //fmt.Println(body) - if resp.StatusCode == 403 { + if strings.Contains(body, "Geoblock") || resp.StatusCode == 403 { return model.Result{Name: name, Status: model.StatusNo} - } else if resp.StatusCode == 302 { + } else if strings.Contains(body, "Log in to") || resp.StatusCode == 302 { return model.Result{Name: name, Status: model.StatusYes} } return model.Result{Name: name, Status: model.StatusUnexpected,