Skip to main content

No project description provided

Project description

BiliTicker-gt-python

极验验证模块的python语言绑定

使用方式

  1. pip install bili_ticket_gt_python
  2. import bili_ticket_gt_python
  3. slide = bili_ticket_gt_python.SlidePy()
  4. click = bili_ticket_gt_python.ClickPy()
  5. 通过slide和click调用相关函数

绑定的函数见py.rs文件

demo

执行测试

import bili_ticket_gt_python
slide = bili_ticket_gt_python.SlidePy()
click = bili_ticket_gt_python.ClickPy()

try:
    #改为注册滑块challenge和gt的url
    validate = slide.test("http://127.0.0.1:5000/pc-geetest/register")
    print(validate)
except Exception as e:
    print("识别失败")
    print(e)

try:
    #改为注册点选challenge和gt的url
    validate = click.test("https://passport.bilibili.com/x/passport-login/captcha?source=main_web")
    print(validate)
except Exception as e:
    print("识别失败")
    print(e)

通过gt和challenge调用 仅支持点选验证码

import bili_ticket_gt_python
click = bili_ticket_gt_python.ClickPy()
try:
    (gt, challenge) = click.register_test("https://passport.bilibili.com/x/passport-login/captcha?source=main_web")
    validate = click.simple_match(gt, challenge)
    print(validate)
except Exception as e:
    print("识别失败")
    print(e)

通过gt和challenge调用(自动重试) 仅支持点选验证码

import bili_ticket_gt_python
click = bili_ticket_gt_python.ClickPy()

try:
    (gt, challenge) = click.register_test("https://passport.bilibili.com/x/passport-login/captcha?source=main_web")
    validate = click.simple_match_retry(gt, challenge)
    print(validate)
except Exception as e:
    #验证码失效有两种可能性
    # 1. 验证码生成过后过了太久,时间导致的失效
    # 2. 验证码重试次数过多,需要unset,unset接口请自己扒下来封装吧,我真的懒得封装了
    print("自动重试仍然有极小概率报错(超时时间即为验证码失效时间)")
    print(e)
#不要100%依赖于demo!!!动动脑子

分步调用

import bili_ticket_gt_python
slide = bili_ticket_gt_python.SlidePy()

try:
    (gt, challenge) = slide.register_test("http://127.0.0.1:5000/pc-geetest/register")
    (_, _) = slide.get_c_s(gt, challenge)
    _type = slide.get_type(gt, challenge)
    if _type != "slide":
        raise Exception("验证码类型错误")
    (c, s, args) = slide.get_new_c_s_args(gt, challenge)
    #注意滑块验证码这里要刷新challenge
    challenge = args[0]
    key = slide.calculate_key(args)
    #rt固定即可
    #此函数是使用项目目录下的slide.exe生成w参数,如果文件不存在会报错,你也可以自己接入生成w的逻辑函数
    w = slide.generate_w(key, gt, challenge, str(c), s, "abcdefghijklmnop")
    (msg, validate) = slide.verify(gt, challenge, w)
    print(validate)
except Exception as e:
    print("识别失败")
    print(e)
import bili_ticket_gt_python
import time
click = bili_ticket_gt_python.ClickPy()

try:
    (gt, challenge) = click.register_test("https://passport.bilibili.com/x/passport-login/captcha?source=main_web")
    (_, _) = click.get_c_s(gt, challenge)
    _type = click.get_type(gt, challenge)
    if _type != "click":
        raise Exception("验证码类型错误")
    (c, s, args) = click.get_new_c_s_args(gt, challenge)
    before_calculate_key = time.time()
    key = click.calculate_key(args)
    #rt固定即可
    #此函数是使用项目目录下的click.exe生成w参数,如果文件不存在会报错,你也可以自己接入生成w的逻辑函数
    w = click.generate_w(key, gt, challenge, str(c), s, "abcdefghijklmnop")
    #点选验证码生成w后需要等待2秒提交
    w_use_time = time.time() - before_calculate_key
    print("w生成时间:", w_use_time)
    if w_use_time < 2:
        time.sleep(2 - w_use_time)
    (msg, validate) = click.verify(gt, challenge, w)
    print(validate)
except Exception as e:
    print("识别失败")
    print(e)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bili_ticket_gt_python-0.2.4.tar.gz (261.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bili_ticket_gt_python-0.2.4-cp312-none-win_amd64.whl (85.5 MB view details)

Uploaded CPython 3.12Windows x86-64

bili_ticket_gt_python-0.2.4-cp312-cp312-manylinux_2_31_x86_64.whl (92.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ x86-64

bili_ticket_gt_python-0.2.4-cp311-none-win_amd64.whl (85.5 MB view details)

Uploaded CPython 3.11Windows x86-64

bili_ticket_gt_python-0.2.4-cp311-cp311-macosx_11_0_arm64.whl (86.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

bili_ticket_gt_python-0.2.4-cp310-none-win_amd64.whl (85.5 MB view details)

Uploaded CPython 3.10Windows x86-64

bili_ticket_gt_python-0.2.4-cp310-cp310-macosx_11_0_arm64.whl (86.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

bili_ticket_gt_python-0.2.4-cp39-none-win_amd64.whl (85.5 MB view details)

Uploaded CPython 3.9Windows x86-64

bili_ticket_gt_python-0.2.4-cp38-none-win_amd64.whl (85.5 MB view details)

Uploaded CPython 3.8Windows x86-64

bili_ticket_gt_python-0.2.4-cp38-cp38-manylinux_2_31_x86_64.whl (92.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.31+ x86-64

File details

Details for the file bili_ticket_gt_python-0.2.4.tar.gz.

File metadata

  • Download URL: bili_ticket_gt_python-0.2.4.tar.gz
  • Upload date:
  • Size: 261.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.6.0

File hashes

Hashes for bili_ticket_gt_python-0.2.4.tar.gz
Algorithm Hash digest
SHA256 9fb38826598485f81db8cc547c2803a7f01b92134ff1745300808be9e6e6527f
MD5 8683e1aee852691fc7fc20010a63e3b0
BLAKE2b-256 98c43d65ed494d7781f9acfae43d1050437814b1823d8ea73e5137b28220bda0

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 adb047863d20394303ae77f86f81c38062c78f1bccf181f4aa6af5173d7af050
MD5 652dc31a4e7378582cdb1e62ada87a14
BLAKE2b-256 910d49277e72766a4dc2c73450cefbc72387e6446e447e326832beaa0652f864

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp312-cp312-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 97a14ab3292a776bf01214daf62bdcffda8a58bc4ccbe3a96b0e398ee03877c1
MD5 4a8804ad1af8ea382b200386fe908f50
BLAKE2b-256 4ff5d8df632ca7d6fdbfd145b1c03a19a707de8a71e9c38ce490e0b2f6aa66a4

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 fbd3b6c55acb0e25f4dab81f2c63d0977b72bc87bf3661ca2fa2b2d0d14ace86
MD5 94076eea1e0ca346423cf5a3cad41ea4
BLAKE2b-256 af09b4750b5aa6324e8d5dce4f41cc353fd0b7d778e6c1553efb0754f550f932

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cdc9ceb8fdf3cdb5f4fd97d959e06f36394124222205b704da649b112c70f8e
MD5 e3a11fc90c4644f4da774e3f2f09ae30
BLAKE2b-256 796417853a639ec4ef4ccc281cb05727f5ce4e95d34bfee5c1d7eee52be26a3a

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 050c073ecb5ae9eb402d9c1310c5a598599c7e52690810bb9a7feb4db1714334
MD5 52eb80c03ff2c8d96d7c2cb2a48e637a
BLAKE2b-256 1d50fc7621fe0720306de1c24cde057c61de219a7331994385fd1586f87c3d45

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 238d7721950d05497859f19a4462deb8b2c2c524018ffb1cf5e6c79dce8adc73
MD5 244947d21697e8db6e69d4c549183d00
BLAKE2b-256 9b03e2e3e8d5d67e12c3918a90042d9da650a4af955a4aab7f24c2306d9c1503

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 85e57f079bb8eb32fe2a2d0576dca932ba4ff2a97b65ff75667f50445cacc2aa
MD5 804f9b7df15f044563457a6d094137e3
BLAKE2b-256 d871eff6b37f03c9bdde39a1081f4878152a62450a98f62252ab25db8d618987

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 87c5f1662e2f8d1726672702afd3cd0f23f1bb51e1e8e0c07351fc041af540ae
MD5 bbff723786f7a5ccc7edd268e25155f3
BLAKE2b-256 e28e553ba80b42190b4db6e184e57d566543fbfc2bc9788723a5dae866bea2fb

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.4-cp38-cp38-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.4-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 6dc89f3e7a5166a739e0cdc174424808efd58d62cf59fe85dd7ce8fce76e4f12
MD5 1143f8bc8123e3013b76cfb11bf2fa1c
BLAKE2b-256 42981138aee9d2980d9f869a2ba033ecafbfb4fa7b3a2bba59636b83f9cbbcba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page