Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

米有舍API变动 #520

Closed
Arondight opened this issue Dec 24, 2021 · 27 comments
Closed

米有舍API变动 #520

Arondight opened this issue Dec 24, 2021 · 27 comments
Assignees
Labels
bug Something isn't working

Comments

@Arondight
Copy link
Owner

@SilveryStar @KimigaiiWuyi 还没抓包,总之老的 api 用不了啦

@Arondight Arondight self-assigned this Dec 24, 2021
@Arondight Arondight added the bug Something isn't working label Dec 24, 2021
@KimigaiiWuyi
Copy link

@KimigaiiWuyi
Copy link

人在车上,没法push到我那边了,尴尬,偏偏挑这个时候

@Arondight
Copy link
Owner Author

参数没改吗

@KimigaiiWuyi
Copy link

参数没改吗

没变

@Arondight
Copy link
Owner Author

其他没有变化,主要改了个api-takumi-record

改了好像也没用

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

试着改了一下,好像还是没东西 原来是我少改了一个 role_ID

diff --git a/src/utils/api.js b/src/utils/api.js
index 7da0035..4bd9acb 100644
--- a/src/utils/api.js
+++ b/src/utils/api.js
@@ -5,11 +5,11 @@ import { getDS } from "./ds.js";

 const __API = {
   FETCH_ROLE_ID: "https://api-takumi.mihoyo.com/game_record/app/card/wapi/getGameRecordCard",
-  FETCH_ROLE_INDEX: "https://api-takumi.mihoyo.com/game_record/app/genshin/api/index",
-  FETCH_ROLE_CHARACTERS: "https://api-takumi.mihoyo.com/game_record/app/genshin/api/character",
+  FETCH_ROLE_INDEX: "https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/index",
+  FETCH_ROLE_CHARACTERS: "https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/character",
   FETCH_GACHA_LIST: "https://webstatic.mihoyo.com/hk4e/gacha_info/cn_gf01/gacha/list.json",
   FETCH_GACHA_DETAIL: "https://webstatic.mihoyo.com/hk4e/gacha_info/cn_gf01/$/zh-cn.json",
-  FETCH_ABY_DETAIL: "https://api-takumi.mihoyo.com/game_record/app/genshin/api/spiralAbyss",
+  FETCH_ABY_DETAIL: "https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/spiralAbyss",
 };
 const HEADERS = {
   "User-Agent":

@Arondight
Copy link
Owner Author

Arondight commented Dec 24, 2021

@Arondight
Copy link
Owner Author

api 返回了一个网页回来

<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="data-spm" content="a3c0e" />
  <title>405</title>
  <style>
    html, body, div, a, h2, p { margin: 0; padding: 0;  }
    a { text-decoration: none; color: #3b6ea3;  }
    .container { width: 1000px; margin: auto; color: #696969; }
    .header { padding: 50px 0; }
    .header .message { height: 36px; padding-left: 120px; background: url(https://errors.aliyun.com/images/TB1TpamHpXXXXaJXXXXeB7nYVXX-104-162.png) no-repeat 0 -128px; line-height: 36px; }
    .main { padding: 50px 0; background: #f4f5f7; }
    .main img { position: relative; left: 120px; }
    .footer { margin-top: 30px; text-align: right; }
    .footer a { padding: 8px 30px; border-radius: 10px; border: 1px solid #4babec; }
    .footer a:hover { opacity: .8; }
    .alert-shadow { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #999; opacity: .5; }
    .alert { display: none; position: absolute; top: 200px; left: 50%; width: 600px; margin-left: -300px; padding-bottom: 25px; border: 1px solid #ddd; box-shadow: 0 2px 2px 1px rgba(0, 0, 0, .1); background: #fff; font-size: 14px; color: #696969; }
    .alert h2 {  margin: 0 2px; padding: 10px 15px 5px 15px; font-size: 14px; font-weight: normal; border-bottom: 1px solid #ddd; }
    .alert a { display: block; position: absolute; right: 10px; top: 8px; width: 30px; height: 20px; text-align: center; }
    .alert p {  padding: 20px 15px; }
  </style>
</head>
<body data-spm="7663354">
  <div data-spm="1998410538">
    <div class="header">
      <div class="container">
        <div class="message">
          很抱歉,由于您访问的URL有可能对网站造成安全威胁,您的访问被阻断。
          <div>您的请求ID是: <strong>
76b20f8916403240667738921e71f6</strong></div>
        </div>
      </div>
    </div>
    <div class="main">
      <div class="container">
        <img src="https://errors.aliyun.com/images/TB15QGaHpXXXXXOaXXXXia39XXX-660-117.png" />
      </div>
    </div>
    <div class="footer">
      <div class="container">
        <a target="_blank" id="report" href="javascript:;" data-spm-click="gostr=/waf.123.123;locaid=d001;">误报反馈</a>
      </div>
    </div>
  </div>
  <div id="alertShadow" class="alert-shadow"></div>
  <div id="alertContainer" class="alert">
    <h2>提示:<a href="javascript:;" title="关闭" id="closeAlert">X</a></h2>
    <p>感谢您的反馈,应用防火墙会尽快进行分析和确认。</p>
  </div>
  <script>
    function show() {
      var g = function(ele) { return document.getElementById(ele); };
      var reportHandle = g('report');
      var alertShadow = g('alertShadow');
      var alertContainer = g('alertContainer');
      var closeAlert = g('closeAlert');
      var own = {};
      own.report = function() {
        // SPM
        own.alert();
      };
      own.alert = function() {
        alertShadow.style.display = 'block';
        alertContainer.style.display = 'block';
      };
      own.close = function() {
        alertShadow.style.display = 'none';
        alertContainer.style.display = 'none';
      };
    };
  </script>
  <script type="text/javascript" charset="utf-8" src="https://errors.aliyun.com/error.js?
76b20f8916403240667738921e71f6"></script>
</body>
</html>

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

这个网页是阿里云的 web application firewall

@Arondight
Copy link
Owner Author

奇怪,为啥阿里云会报错米有舍的api 是有害的

@mark9804
Copy link
Collaborator

这个 api 应该是可以直接访问的啊,我直接拿浏览器打开可以,虽然没填cookie, ds
image

Arondight added a commit that referenced this issue Dec 24, 2021
@Arondight
Copy link
Owner Author

你更新一下代码看看,可能是我的 vps 被拦截了

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

我的个人 PC 可以,可能老大哥要换个 vps 了

@mark9804
Copy link
Collaborator

确认代码是可以工作的,能够正常生成米游社和深渊图片

测试环境:macOS,node v17.2.0

@KimigaiiWuyi
Copy link

我的个人 PC 可以,可能老大哥要换个 vps 了

阿里云挂了 我的也不行,腾讯云不清楚,国外机子一切正常,本地树莓派也正常

@Arondight
Copy link
Owner Author

我的 vps 是腾讯的,也挂了

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

阿里云挂了 我的也不行,腾讯云不清楚,国外机子一切正常,本地树莓派也正常

我记得 @Arondight 用的是腾讯云的机子,这么看来的话可能是 WAF 配置把云服务商的IP段干掉了?

还好双十二的时候家境贫寒没上云

@Arondight
Copy link
Owner Author

但是我看返回的网页,他写的意思明明是米有舍 api 是有害的,而不是我的 ip 是有害的啊

@wudifeixue
Copy link

我国外的自己家,目前修改后就能正常使用了

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

由于您访问的URL有可能对网站造成安全威胁,您的访问被阻断。

假设他说的是真的,那么这种情况一般可能是因为 client 构造了一个可能包含攻击性参数的请求(或者请求频率过高),比如我的 CloudFlare WAF 每天都能拦下一堆访问了非法路径的事件

image

但是我觉得他可能单纯就是判定你是个机器人

@wudifeixue
Copy link

这有点尴尬啊,为啥vps都被针对了,我没有测试国外的vps例如aws,digital ocean这类的,我也属于家里自建了,有能力测试的小伙伴看看吧

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

可以测试一下,在自己的本地网络跑机器人,然后搭一个跳板,通过 VPS 的 IP 再执行一次米游社查询请求,这样就能知道是不是 IP 段封锁了

他写的意思明明是米有舍 api 是有害的,而不是我的 ip 是有害的啊

按我的理解,他说的意思是“你向这个网页发送请求的行为本身对网站是有害的”,不是说“这个网站本身是有害的”

@Arondight
Copy link
Owner Author

好吧,那可能是官方注意到这里了,我准备随时跑路了,这个项目不值得对我工作产生影响

@Arondight
Copy link
Owner Author

我的搬到树莓派3b里了,勉强凑合用

图片

@mark9804
Copy link
Collaborator

mark9804 commented Dec 24, 2021

加一个简单的检测吧,如果返回数据 parse 不出来 json 数据,并且检测到 <!DOCTYPE html> 之类的 html 标签,就给 master 发送一条消息说自己被死亡宣告了

@Arondight
Copy link
Owner Author

加一个简单的检测吧,如果返回数据 parse 不出来 json 数据,并且检测到 <!DOCTYPE html> 之类的 html 标签,就给 master 发送一条消息说自己被死亡宣告了

ok,这个简单,明天加一下,晚上想摸会鱼睡觉 zzZ

@Arondight
Copy link
Owner Author

备忘:还有一个角色数据图 css 中的 url 得扒下来

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants