Womsxd / MihoyoBBSTools

Womsxd/AutoMihoyoBBS,米游社相关脚本
MIT License
747 stars 139 forks source link

无法获取崩坏3账号列表 #124

Closed lostkira closed 5 months ago

lostkira commented 5 months ago

运行方式: Docker Compose 2024-02-26 23:50:26时的最新版本仍然有此问题

日志: 2024-02-26T23:50:26 INFO 正在进行崩坏3签到 2024-02-26T23:50:26 INFO 正在获取米哈游账号绑定的崩坏3账号列表... Traceback (most recent call last): File "/var/app/./main.py", line 140, in status_code, message = main() ^^^^^^ File "/var/app/./main.py", line 86, in main honkai3rd_help = honkai3rd.Honkai3rd() ^^^^^^^^^^^^^^^^^^^^^ File "/var/app/honkai3rd.py", line 7, in init super(Honkai3rd, self).init("bh3_cn", setting.any_checkin_rewards.format(setting.honkai3rd_Act_id)) File "/var/app/gamecheckin.py", line 18, in init self.account_list = get_account_list(self.game_id, self.headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/app/account.py", line 11, in get_account_list req = http.get(setting.account_Info_url + game_id, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1054, in get return self.request( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 814, in request request = self.build_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 346, in build_request headers = self._merge_headers(headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 409, in _merge_headers merged_headers.update(headers) File "/usr/local/lib/python3.12/site-packages/httpx/_models.py", line 201, in update headers = Headers(headers) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_models.py", line 76, in init normalize_header_value(v, encoding), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_utils.py", line 53, in normalize_header_value return value.encode(encoding or "ascii") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeEncodeError: 'ascii' codec can't encode character '\uff1b' in position 626: ordinal not in range(128)

Womsxd commented 5 months ago

就是崩坏3无法签到吗?

lostkira commented 5 months ago

我试了星穹铁道也不行,也是这个问题 大别野看帖点赞之类的是正常的

Womsxd commented 5 months ago

我试了星穹铁道也不行,也是这个问题 大别野看帖点赞之类的是正常的

无法复现,python 3.8,能提供一下你的config.yaml吗? 记得处理掉account部分的全部内容,如果有配置云原神,还请处理token

lostkira commented 5 months ago

是用docker compose部署的 应该不涉及环境问题

enable: true
version: 9
mihoyobbs:
  enable: true
  checkin: true
  checkin_multi: false
  checkin_multi_list:
  - 1
  - 2
  - 5
  - 6
  read_posts: true
  like_posts: true
  cancel_like_posts: true
  share_post: true
games:
  cn:
    enable: true
    useragent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15
      (KHTML, like Gecko) Version/16.5.1 Mobile/15E148 Safari/604.1
    genshin:
      auto_checkin: false
      black_list: []
    honkai2:
      auto_checkin: false
      black_list: []
    honkai3rd:
      auto_checkin: true
      black_list:
      - ''
      - ''
    tears_of_themis:
      auto_checkin: false
      black_list: []
    honkai_sr:
      auto_checkin: true
      black_list: []
  os:
    enable: false
    cookie: ''
    genshin:
      auto_checkin: false
      black_list: []
    honkai_sr:
      auto_checkin: false
      black_list: []
cloud_games:
  genshin:
    enable: false
    token: ''
Womsxd commented 5 months ago

感觉像是useragent字段导致的问题,你可以试试用"包成一行

"Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.1 Mobile/15E148 Safari/604.1"
lostkira commented 5 months ago

用""包起来 或者更新user-agent都尝试了,问题依旧

Womsxd commented 5 months ago

要不 config.yaml.example 你重新配置,只改account.cookie,然后只开启游戏签到看看?

Womsxd commented 5 months ago

感觉是cookie的问题,你找找看cookie里面有没有 \uff1b,这个是中文的分号,替换为;

lostkira commented 5 months ago

感觉是cookie的问题,你找找看cookie里面有没有 \uff1b,这个是中文的分号,替换为;

是这个问题,编辑器没高亮,没注意到。感谢