Skip to content

Commit

Permalink
v0.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jul 4, 2024
1 parent e6deaa5 commit ec43ec9
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 144 deletions.
17 changes: 0 additions & 17 deletions africa/BeinConnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// BeinConnect
Expand All @@ -19,43 +18,27 @@ func BeinConnect(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
url := "https://proxies.bein-mena-production.eu-west-2.tuc.red/proxy/availableOffers"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("BeinConnect Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
if err != nil {
if model.EnableLoger {
Logger.Info("BeinConnect read resp.Body failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
}
body := string(b)
//fmt.Println(body)
if strings.Contains(body, "Unavailable For Legal Reasons") ||
resp.StatusCode == 403 || resp.StatusCode == 451 {
if model.EnableLoger {
Logger.Info("BeinConnect access denied due to legal reasons: " + body)
}
return model.Result{Name: name, Status: model.StatusNo}
} else if resp.StatusCode == 200 || resp.StatusCode == 500 {
result1, result2, result3 := utils.CheckDNS(hostname)
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
}
if model.EnableLoger {
Logger.Info(fmt.Sprintf("BeinConnect unexpected response code: %d", resp.StatusCode))
}
return model.Result{Name: name, Status: model.StatusUnexpected,
Err: fmt.Errorf("get proxies.bein-mena-production.eu-west-2.tuc.red failed with code: %d", resp.StatusCode)}
}
11 changes: 0 additions & 11 deletions africa/DSTV.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// DSTV
Expand All @@ -17,17 +16,10 @@ func DSTV(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
url := "https://authentication.dstv.com/favicon.ico"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("DSTV Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
Expand All @@ -44,9 +36,6 @@ func DSTV(c *http.Client) model.Result {
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
}
if model.EnableLoger {
Logger.Info(fmt.Sprintf("DSTV unexpected response code: %d", resp.StatusCode))
}
return model.Result{Name: name, Status: model.StatusUnexpected,
Err: fmt.Errorf("get authentication.dstv.com failed with code: %d", resp.StatusCode)}
}
14 changes: 0 additions & 14 deletions africa/Showmax.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// Showmax
Expand All @@ -19,10 +18,6 @@ func Showmax(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
url := "https://www.showmax.com/"
headers := map[string]string{
"Host": "www.showmax.com",
Expand All @@ -43,17 +38,11 @@ func Showmax(c *http.Client) model.Result {
client = utils.SetReqHeaders(client, headers)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("Showmax Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
if err != nil {
if model.EnableLoger {
Logger.Info("Showmax can not parse body: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
}
body := string(b)
Expand All @@ -69,9 +58,6 @@ func Showmax(c *http.Client) model.Result {
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, Region: strings.ToLower(region), UnlockType: unlockType}
}
if model.EnableLoger {
Logger.Info(fmt.Sprintf("Showmax unexpected response code: %d", resp.StatusCode))
}
return model.Result{Name: name, Status: model.StatusUnexpected,
Err: fmt.Errorf("get www.showmax.com failed with code: %d", resp.StatusCode)}
}
17 changes: 0 additions & 17 deletions asia/Bilibili.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// Bilibili
Expand All @@ -19,24 +18,14 @@ func Bilibili(c *http.Client, name, url string) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("Bilibili Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
if err != nil {
if model.EnableLoger {
Logger.Info("Bilibili can not parse body: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
}
body := string(b)
Expand All @@ -48,9 +37,6 @@ func Bilibili(c *http.Client, name, url string) model.Result {
if strings.Contains(body, "抱歉您所在地区不可观看") {
return model.Result{Name: name, Status: model.StatusNo}
}
if model.EnableLoger {
Logger.Info("Bilibili can not parse json: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusErr, Err: err}
}
if strings.Contains(body, "抱歉您所在地区不可观看") || strings.Contains(body, "The area is inaccessible") ||
Expand All @@ -63,9 +49,6 @@ func Bilibili(c *http.Client, name, url string) model.Result {
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
}
if model.EnableLoger {
Logger.Info(fmt.Sprintf("Bilibili unexpected response code: %d", resp.StatusCode))
}
return model.Result{Name: name, Status: model.StatusUnexpected,
Err: fmt.Errorf("get api.bilibili.com failed with code: %d", resp.StatusCode)}
}
14 changes: 0 additions & 14 deletions asia/HBOGO.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// HBOGO
Expand All @@ -20,25 +19,15 @@ func HBOGO(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
url := "https://api2.hbogoasia.com/v1/geog?lang=undefined&version=0&bundleId=www.hbogoasia.com"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("hbogoasia Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
if err != nil {
if model.EnableLoger {
Logger.Info("hbogoasia can not parse body: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
}
//body := string(b)
Expand All @@ -48,9 +37,6 @@ func HBOGO(c *http.Client) model.Result {
Territory string `json:"territory"`
}
if err := json.Unmarshal(b, &hboRes); err != nil {
if model.EnableLoger {
Logger.Info("hbogoasia can not parse json: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusErr, Err: err}
}
if hboRes.Territory == "" {
Expand Down
11 changes: 0 additions & 11 deletions asia/Hotstar.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// HotStar
Expand All @@ -18,17 +17,10 @@ func HotStar(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
url := "https://api.hotstar.com/o/v1/page/1557?offset=0&size=20&tao=0&tas=20"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("api.hotstar.com Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
Expand All @@ -38,9 +30,6 @@ func HotStar(c *http.Client) model.Result {
}
resp1, err1 := client.R().Get("https://www.hotstar.com")
if err1 != nil {
if model.EnableLoger {
Logger.Info("www.hotstar.com Get request failed: " + err1.Error())
}
return model.Result{Name: name, Status: model.StatusUnexpected,
Err: fmt.Errorf("get api.hotstar.com failed with code1: %d", resp.StatusCode)}
}
Expand Down
17 changes: 0 additions & 17 deletions asia/MolaTV.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
. "github.com/oneclickvirt/defaultset"
)

// MolaTV
Expand All @@ -20,25 +19,15 @@ func MolaTV(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
url := "https://mola.tv/api/v2/videos/geoguard/check/vd30491025"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
if model.EnableLoger {
Logger.Info("mola.tv Get request failed: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
if err != nil {
if model.EnableLoger {
Logger.Info("mola.tv can not parse body: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
}
body := string(b)
Expand All @@ -56,9 +45,6 @@ func MolaTV(c *http.Client) model.Result {
if strings.Contains(body, "\"isAllowed\":false") {
return model.Result{Name: name, Status: model.StatusNo}
}
if model.EnableLoger {
Logger.Info("mola.tv can not parse json: " + err.Error())
}
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
}
if !res.Data.Attributes.IsAllowed {
Expand All @@ -68,9 +54,6 @@ func MolaTV(c *http.Client) model.Result {
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
}
if model.EnableLoger {
Logger.Info(fmt.Sprintf("mola.tv unexpected response code: %d", resp.StatusCode))
}
return model.Result{Name: name, Status: model.StatusUnexpected,
Err: fmt.Errorf("get mola.tv failed with code: %d", resp.StatusCode)}
}
Loading

0 comments on commit ec43ec9

Please sign in to comment.