Skip to content

Commit

Permalink
v0.0.8 - 修复 J:com On Demand 和 FuboTV 的检测
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jun 28, 2024
1 parent 46f3e30 commit a3664a2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
TAG="v0.0.7-$(date +'%Y%m%d%H%M%S')"
TAG="v0.0.8-$(date +'%Y%m%d%H%M%S')"
git tag $TAG
git push origin $TAG
env:
Expand Down
11 changes: 6 additions & 5 deletions jp/J_COM_ON_DEMAND.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ package jp

import (
"fmt"
"net/http"

"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
"net/http"
)

// J_COM_ON_DEMAND
// linkvod.myjcom.jp 仅 ipv4 且 get 请求
func J_COM_ON_DEMAND(c *http.Client) model.Result {
name := "J:com On Demand"
hostname := "myjcom.jp"
hostname := "id2.zaq.ne.jp"
if c == nil {
return model.Result{Name: name}
}
url := "https://linkvod.myjcom.jp/auth/login"
url := "https://auth.id2.zaq.ne.jp/login"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
Expand All @@ -28,9 +29,9 @@ func J_COM_ON_DEMAND(c *http.Client) model.Result {
//}
//body := string(b)
//fmt.Println(body)
if resp.StatusCode == 403 || resp.StatusCode == 404 || resp.StatusCode == 451 {
if resp.StatusCode == 400 || resp.StatusCode == 403 || resp.StatusCode == 404 || resp.StatusCode == 451 {
return model.Result{Name: name, Status: model.StatusNo}
} else if resp.StatusCode == 502 {
} else if resp.StatusCode == 200 {
result1, result2, result3 := utils.CheckDNS(hostname)
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
Expand Down
47 changes: 36 additions & 11 deletions us/FuboTV.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package us

import (
"fmt"
"github.com/oneclickvirt/UnlockTests/model"
"github.com/oneclickvirt/UnlockTests/utils"
"io"
"math/rand"
"net/http"
"strconv"
"strings"
"regexp"

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

// FuboTV
Expand All @@ -19,8 +18,9 @@ func FuboTV(c *http.Client) model.Result {
if c == nil {
return model.Result{Name: name}
}
randNum := strconv.Itoa(rand.Intn(2))
url := "https://api.fubo.tv/appconfig/v1/homepage?platform=web&client_version=R20230310." + randNum + "&nav=v0"
// randNum := strconv.Itoa(rand.Intn(2))
// url := "https://api.fubo.tv/appconfig/v1/homepage?platform=web&client_version=R20230310." + randNum + "&nav=v0"
url := "https://api.fubo.tv/v3/location"
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
Expand All @@ -32,13 +32,38 @@ func FuboTV(c *http.Client) model.Result {
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
}
body := string(b)
if strings.Contains(body, "No Subscription") {
// if strings.Contains(body, "No Subscription") {
// result1, result2, result3 := utils.CheckDNS(hostname)
// unlockType := utils.GetUnlockType(result1, result2, result3)
// return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
// } else if strings.Contains(body, "Forbidden IP") {
// return model.Result{Name: name, Status: model.StatusNo, Info: "IP Forbidden"}
// } else {
// return model.Result{Name: name, Status: model.StatusNo}
// }
// 定义正则表达式
noServiceRegex := regexp.MustCompile(`(?i)NO_SERVICE_IN_COUNTRY`)
isAllowedRegex := regexp.MustCompile(`"network_allowed":true`)
isBlockedRegex := regexp.MustCompile(`"network_allowed":false`)
countryCodeRegex := regexp.MustCompile(`"country_code2":"([^"]+)"`)
// 检查noService
noService := noServiceRegex.FindString(body)
// 检查isAllowed
isAllowed := isAllowedRegex.FindString(body)
// 检查isBlocked
isBlocked := isBlockedRegex.FindString(body)
// 提取countryCode
countryCodeMatch := countryCodeRegex.FindStringSubmatch(body)
if isAllowed != "" && len(countryCodeMatch) > 1 {
countryCode := countryCodeMatch[1]
result1, result2, result3 := utils.CheckDNS(hostname)
unlockType := utils.GetUnlockType(result1, result2, result3)
return model.Result{Name: name, Status: model.StatusYes, UnlockType: unlockType}
} else if strings.Contains(body, "Forbidden IP") {
return model.Result{Name: name, Status: model.StatusYes, Region: countryCode, UnlockType: unlockType}
} else if isBlocked != "" {
return model.Result{Name: name, Status: model.StatusNo, Info: "IP Forbidden"}
} else {
} else if noService != "" {
return model.Result{Name: name, Status: model.StatusNo}
} else {
return model.Result{Name: name, Status: model.StatusUnexpected}
}
}
3 changes: 2 additions & 1 deletion us/us_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package us

import (
"fmt"
"github.com/oneclickvirt/UnlockTests/utils"
"testing"

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

func Test(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion uts/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package uts

const UnlockTestsVersion = "v0.0.7"
const UnlockTestsVersion = "v0.0.8"

0 comments on commit a3664a2

Please sign in to comment.