Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jun 21, 2024
1 parent 9b833aa commit 76947cc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tw/BahamutAnime.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ func BahamutAnime(c *http.Client) model.Result {
return model.Result{Name: name}
}
url := "https://ani.gamer.com.tw/ajax/getdeviceid.php"
headers := map[string]string{
"User-Agent": model.UA_Browser,
}
client := utils.ReqDefault(c)
client = utils.SetReqHeaders(client, headers)
client := utils.Req(c)
resp, err := client.R().Get(url)
if err != nil {
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err}
Expand All @@ -48,14 +44,21 @@ func BahamutAnime(c *http.Client) model.Result {
if err := json.Unmarshal([]byte(body), &res); err != nil {
return model.Result{Name: name, Status: model.StatusErr, Err: err}
}
// fmt.Println(res.Deviceid)
fmt.Println(res.Deviceid)

// 14667
sn := "37783"
resp2, err2 := client.R().Get("https://ani.gamer.com.tw/ajax/token.php?adID=89422&sn=" + sn + "&device=" + res.Deviceid)
if err2 != nil {
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err2}
}
defer resp2.Body.Close()
b2, err2 := io.ReadAll(resp2.Body)
if err2 != nil {
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err2}
}
body2 := string(b2)

resp3, err3 := client.R().Get("https://ani.gamer.com.tw/")
if err3 != nil {
return model.Result{Name: name, Status: model.StatusNetworkErr, Err: err3}
Expand All @@ -74,7 +77,7 @@ func BahamutAnime(c *http.Client) model.Result {
// }
// fmt.Println(res3.AnimeSn)
fmt.Println(body3)
if strings.Contains(body3, "animeSn") {
if !strings.Contains(body2, "animeSn") {
return model.Result{Name: name, Status: model.StatusYes}
} else if resp2.StatusCode == 403 || resp2.StatusCode == 404 {
return model.Result{Name: name, Status: model.StatusNo}
Expand Down

0 comments on commit 76947cc

Please sign in to comment.