txperl / PixivBiu

Pixiv 辅助工具
https://biu.tls.moe/
MIT License
984 stars 70 forks source link

[PixivBiu] There was an error getting the token, please try again. #66

Open ltctkycghgVUVUYV opened 7 hours ago

ltctkycghgVUVUYV commented 7 hours ago

bonjours, je ne parviens pas faire validé mes tokens de connection pixiv malgré plusieurs essaie.

OS: Ubuntu 24.04.1 LTS x86_64 Kernel: 6.8.0-47-generic

mon fichier "config.yml"

# It is the default configuration file for PixivBiu.
# There is no English version yet... It will be available soon.
# You can use the translation tool to read it, for now.

## 系统相关 ##
sys.host: "127.0.0.1:4008"
  # 程序运行的地址,如果不是很懂请不要修改
  # 不可带有 http:// 前缀

sys.debug: false
  # 调试模式
  # true 为开启;false 为关闭

sys.apiRoute: "bypassSNI"
  # 默认 api 线路
  # direct: 稳定,需要代理
  # bypassSNI: 稳定性一般,无需代理

sys.proxy: "no"
  # 本地代理服务监听地址
  # 如 http://127.0.0.1:1080/
  # 留空则程序会自动检测系统代理设置(仅 Windows、macOS)
  # 填入 no 则不使用任何代理

sys.language: "en"
  # 语言设置,留空为程序自动判断
  # 可选:zh、en

sys.theme: "multiverse"
  # 默认主题
  # 暂无其他,请保持默认为 multiverse

sys.autoOpen: false
  # 启动后是否自动打开程序运行网址
  # true 为开启;false 为关闭

sys.ignoreOutdated: false
  # 启动时是否禁用新版本提示
  # true 为开启;false 为关闭

## 搜索相关 ##
biu.search.maxThreads: 8
  # 搜索池最大线程数

biu.search.loadCacheFirst: true
  # 搜索时优先加载本地缓存
  # true 为开启;false 为关闭

biu.search.maxCacheSizeMiB: 3073
  # 搜索缓存的最大容量(MB),达到后程序会自动清理

## 下载相关 ##
biu.download.mode: "dl-single"
  # 下载模式
  # dl-single: 程序单线程下载
  # aria2: 使用 aria2 下载,如果启用此项,还需填写下方的 aria2Host、aria2Secret

biu.download.aria2Host: ""
  # aria2 RPC 监听地址,如 localhost:6800
  # 下载时 dir, out, all-proxy, max-tries, check-certificate 配置项会由程序决定
  # 其余均为默认或自定义内容

biu.download.aria2Secret: ""
  # aria2 RPC 密钥,如未设置请留空

biu.download.deterPaths: true
  # 程序动态决定文件名
  # 启用后,程序会先以随机名称保存图片,后更改为自定义的 {saveFileName} 文件名
  #   此过程中,会自动判断下载目录中,文件名相同的图片是否为同一作品
  #   若是,则只保留一份;若不是,则自动将新图片重命名
  #   新文件名格式为 {saveFileName}_{hash} 或 {saveFileName}_{hash}_{time}
  # 停用后,程序会直接将图片保存为自定义的 {saveFileName} 文件名
  #   若 {saveFileName} 格式存在唯一性,或欲使用 aria2 的重名文件策略,可将此功能关闭以提升性能
  #   若 aria2 服务地址并非 localhost 或 127.0.0.1 时,程序会自动禁用此项
  # true 为开启;false 为关闭

biu.download.maxDownloading: 8
  # 最大同时下载任务数

biu.download.saveURI: "{HOMEPATH}/mnt/Unreal/Multimedia/Photos/PixivBiu/{type}/"
  # 下载保存路径,以 / 结尾
  # 不可使用 \ 符号,请将其替换为 / 或 \\
  # 可选变量
  # - {ROOTPATH}: 程序根目录
  # - {HOMEPATH}: 用户主目录,可能为 /Users/user/、C:/Users/user/、/home/user/
  # - {KT}: 搜索关键词
  # - {title}: 作品标题
  # - {work_id}: 作品 ID
  # - {user_name}: 作者名称
  # - {user_id}: 作者 ID
  # - {type}: 作品类型
  # - {date_image}: 作品日期
  # - {date_today}: 当天日期

biu.download.saveFileName: "{title}_{work_id}"
  # 下载图片的标题
  # 不可使用 \ 符号,请将其替换为 \\
  # 可选变量
  # - {title}: 作品标题
  # - {work_id}: 作品 ID
  # - {user_name}: 作者名称
  # - {user_id}: 作者 ID
  # - {type}: 作品类型
  # - {date_image}: 作品日期
  # - {date_today}: 当天日期

biu.download.autoArchive: true
  # 自动将拥有多张图片的作品归档(放入一个文件夹中)
  # true 为开启;false 为关闭

biu.download.whatsUgoira: "gif"
  # 将动图转换为指定格式
  # 可选 webp, gif

biu.download.imageHost: "https://i.pixiv.re"
  # 后端程序下载时使用的 Pixiv 图片服务器
  # 留空则程序自动判断
  # 可参考地址
  # - https://i.pximg.net 官方图片服务器(需代理)
  # - https://i.pixiv.cat 第三方反代图片服务器(需代理)
  # - https://i.pixiv.re 第三方反代图片服务器(无需代理)

# 私密
secret.key.apiSauceNAO: "a96e3bddfcf7a83bca1727e02301eca4149a8cde"
  # SauceNAO 服务的 API key,若填写则可使用图片搜索功能
  # https://saucenao.com/user.php?page=search-api
  # 进入以上网址登录后,即可在页面上找到「api key」内容

la sortie :

dawnload@old-machina:/mnt/OverKill/System/PixivBiu$ python main.py
[Altfe] ;)
[PixivBiu] Since Pixiv disables password login, you can only use token to login for now
Continue? (y / n): y
[Login Helper] Network detection is about to start, this process can reduce the probability of not being able to use PixivBiu due to network problems
[Login Helper] Doing network detection...
The system proxy address was not detected, do you need to set it manually? (y / n): n
[Network] https://public-api.secure.pixiv.net [yep]
[Network] https://1.0.0.1/dns-query [yep]
[Login] Please follow steps below:
1. Visit: https://app-api.pixiv.net/web/v1/login?code_challenge=*******L0hCsbCCK2_bfdtZSyA3DGolKXEgQ9Twqdec&code_challenge_method=S256&client=pixiv-android
2. Open the browser's [Developer Tools / F12] and switch to the [Network] tab
3. Turn on [Preserve log]
4. Type [callback?] in the [Filter] input box
5. Login to your Pixiv account
6. After successfully logging in, there will be a message like [https://app-api.pixiv.net/...&code=...]
7. Enter the parameter after [code] into this program
Code: xTwDPo2YgHyptVcMh__tfU4fTTN9ZcdIH5I5sDKKUEM
!Error at 2024-10-17 10:07:51:
Traceback (most recent call last):
  File "/mnt/OverKill/System/PixivBiu/app/lib/core/biu.py", line 146, in __login
    raise Exception("" if refresh_token is False else "Core.Biu.__login: refresh_token is missing")
Exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 468, in _make_request
    self._validate_conn(conn)
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1097, in _validate_conn
    conn.connect()
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connection.py", line 642, in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connection.py", line 783, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
               ^^^^^^^^^^^^^^^^
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 471, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 515, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/ssl.py", line 1033, in _create
    self._sslobj = self._context._wrap_socket(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:806)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 492, in _make_request
    raise new_e
urllib3.exceptions.SSLError: Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:806)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 845, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/dawnload/.local/lib/python3.12/site-packages/urllib3/util/retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='public-api.secure.pixiv.net', port=443): Max retries exceeded with url: /auth/token (Caused by SSLError(SSLError(0, 'Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:806)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/OverKill/System/PixivBiu/app/lib/common/login_helper/main.py", line 73, in login
    return self.token_getter.login(host=self.auth_token_url, newCode=True, kw=kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/OverKill/System/PixivBiu/app/lib/common/login_helper/token.py", line 66, in login
    response = self.requests.post(
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/requests/adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='public-api.secure.pixiv.net', port=443): Max retries exceeded with url: /auth/token (Caused by SSLError(SSLError(0, 'Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:806)')))

[PixivBiu] There was an error getting the token, please try again.
Press any key to exit...

Serait il possible d'obtenir de l'aide ?

ltctkycghgVUVUYV commented 7 hours ago

j'ai masqué partiellement mon token dans mon message avec des *. Dans la réalité, j'ai bien copier le token entier

txperl commented 6 hours ago

Could you have a try logging in with PixivBiu v2.6.1?

The issue you encountered is a bit weird, and some people have the same situation. It relates to the Python modules and local SSL certificates. But actually, I don't have many ideas about how to fix it either.