Skip to content

Commit 8858864

Browse files
committed
fix:修复netflix解锁判断
1 parent 2263238 commit 8858864

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

transnation/Netflix.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func Netflix(c *http.Client) model.Result {
7070
if c == nil {
7171
return model.Result{Name: name}
7272
}
73-
url1 := "https://www.netflix.com/title/81280792" // 乐高
74-
url2 := "https://www.netflix.com/title/70143836" // 绝命毒师
73+
url1 := "https://www.netflix.com/title/70143836" // 绝命毒师
74+
url2 := "https://www.netflix.com/title/81280792" // 乐高
7575
url3 := "https://www.netflix.com/title/80018499" // Test Patterns
7676
client1 := utils.Req(c)
7777
resp1, err1 := client1.R().Get(url1)
@@ -92,22 +92,24 @@ func Netflix(c *http.Client) model.Result {
9292
return model.Result{Name: name, Status: model.StatusBanned}
9393
}
9494
if (resp1.StatusCode == 200 || resp1.StatusCode == 301) || (resp2.StatusCode == 200 || resp2.StatusCode == 301) {
95+
// 检查resp2的body内容,判断是否真正解锁
96+
b2, err := io.ReadAll(resp2.Body)
97+
if err != nil {
98+
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
99+
}
100+
body2 := string(b2)
101+
hasVideo := strings.Contains(body2, `property="og:video"`)
102+
hasEpisodes := strings.Contains(body2, `data-uia="episodes"`)
103+
hasPlayableVideo := strings.Contains(body2, `playableVideo`)
104+
if !hasVideo && !hasEpisodes && !hasPlayableVideo {
105+
return model.Result{Name: name, Status: model.StatusNo}
106+
}
95107
client3 := utils.Req(c)
96108
resp3, err3 := client3.R().Get(url3)
97109
if err3 != nil {
98110
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err3}
99111
}
100112
defer resp3.Body.Close()
101-
//b3, err3 := io.ReadAll(resp3.Body)
102-
//if err3 != nil {
103-
// return model.Result{Name: name, Status: model.StatusNetworkErr, Err: fmt.Errorf("can not parse body")}
104-
//}
105-
//body3 := string(b3)
106-
//if body3 == "" {
107-
// return model.Result{
108-
// Name: name, Status: model.StatusNo,
109-
// }
110-
//}
111113
u := resp3.Header.Get("location")
112114
if u == "" {
113115
result1, result2, result3 := utils.CheckDNS(hostname)

0 commit comments

Comments
 (0)