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.6.tar.gz (261.2 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.6-cp312-none-win_amd64.whl (85.6 MB view details)

Uploaded CPython 3.12Windows x86-64

bili_ticket_gt_python-0.2.6-cp312-cp312-manylinux_2_35_x86_64.whl (93.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

bili_ticket_gt_python-0.2.6-cp312-cp312-macosx_11_0_arm64.whl (86.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bili_ticket_gt_python-0.2.6-cp312-cp312-macosx_10_12_x86_64.whl (87.6 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bili_ticket_gt_python-0.2.6-cp311-none-win_amd64.whl (85.6 MB view details)

Uploaded CPython 3.11Windows x86-64

bili_ticket_gt_python-0.2.6-cp311-cp311-macosx_11_0_arm64.whl (86.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

bili_ticket_gt_python-0.2.6-cp311-cp311-macosx_10_12_x86_64.whl (87.6 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

bili_ticket_gt_python-0.2.6-cp310-none-win_amd64.whl (85.6 MB view details)

Uploaded CPython 3.10Windows x86-64

bili_ticket_gt_python-0.2.6-cp310-cp310-manylinux_2_35_x86_64.whl (93.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

bili_ticket_gt_python-0.2.6-cp310-cp310-macosx_11_0_arm64.whl (86.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

bili_ticket_gt_python-0.2.6-cp39-none-win_amd64.whl (85.6 MB view details)

Uploaded CPython 3.9Windows x86-64

bili_ticket_gt_python-0.2.6-cp39-cp39-macosx_11_0_arm64.whl (86.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

bili_ticket_gt_python-0.2.6-cp38-none-win_amd64.whl (85.6 MB view details)

Uploaded CPython 3.8Windows x86-64

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6.tar.gz
Algorithm Hash digest
SHA256 39ffcd1bed6ad2f6ea01ef1490e94bc703f0a51cb3564ac68d38707f20eee894
MD5 db11a7c9442e75814d640ad45f331a07
BLAKE2b-256 b9a6ae6392063e84b6692ed43f9fa592091496fec188840b877ba742ae56e143

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 1080877c8408478c96644f848cecda48622bd811e51e9928d751db4434c4a9e5
MD5 008160b2cfed7cd8c8c0505ff3c11bdb
BLAKE2b-256 ea053ff1877982c523794cb0ca1c7d8d0e91273dce5b6239c54d5ab90413c051

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.6-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 124347c61f5df4945877fb963ef17fff99bc25557ca1fcdc16e9fe7c52cf83c8
MD5 1d4baf87b8c05660336119c48479a97e
BLAKE2b-256 94d3eccf8d1c7281fcd14a4bdf26ef23e585122a3e2735c42525b74dc76dff65

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f0994d4edc84dc866137ca0fe5b4b1569f6bf6f8b42e0427cd93b5a393e11967
MD5 6e798a5d71cdfa692a4502d6027d34ff
BLAKE2b-256 e6c315bfb06034c7b9c15e3a86b92ebf44391dfb2fc7ccf1691d3ca2f5e194fd

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.6-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d9a7f493f8fc471c2c091d089133e03f7c2c2277f40be91cd309a9d224701dfc
MD5 4c6955aafaa28eb9d647c0c0fa72b3cd
BLAKE2b-256 59bb929ee323035354c4184cc16c14f6100c53946cf754c17298103ae7272502

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 d06a12cc1d44856c0d41d547c907180feff2d4af9233d2c00630042dc58458d1
MD5 913cc5ac29ccd138cafe60e8557eb24d
BLAKE2b-256 02caa96f958c8e9e49eb899b60425a4bbf4a864e31c8be459bec6ef4186a3002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f447862fa09c19018014fb3fdf2de03dd361d57c5d31e6048a2b80050ce9ea6
MD5 1cc161a343978a9206ec643e397fad45
BLAKE2b-256 f400870f04da76742800661fc2a5e9423dfba963b907aa3ae94b25b81153d3ed

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.6-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 10122d38e650fb25e1c09b8c1edb169b54b887ad52eb6231eb512249b31d8a91
MD5 2ddca3d89fff987590f90ada42871573
BLAKE2b-256 a6c7e924fb1dbf9166ab6e191f0a4a1d2655ba358f7f17b8c6a1a516a2472d09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 0bd4e8f90853b999429ccca6042164d92d3dda12ffee6c047cc0fb99380f9ff0
MD5 27585a9ccc797ddd02239012abe9d71b
BLAKE2b-256 0bbab175e789624c5451c4ee5a1bd038c440a678a2a9a970d1b33ed477b05b8d

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.6-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 5cca6602a9f9aec36584b52f2cbc644064c5141c8ac7d1617c674758f6459503
MD5 3c1d54dec2c69b0eb0e24e8d83986ab6
BLAKE2b-256 b51056fddfcedf96924bf7f83ac6db7b8e02ebd831686ac6bccdde558baa9eaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a62c8c3320a6e7aec191ea832b5e208af45c88f82bd2889f8b77e46393b927e
MD5 f30faaf05d05cfd48656b34ad59be2bd
BLAKE2b-256 231f164b3f995adac08cf4ae90427f3d107ceed4ab86757c9dadbd3a9b6e58af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 7e69650139ba8c87dc6ab49a7136993126b3987e600f261f291e07a67ea1989f
MD5 7df1d8955eeb7f6782dc53a84d90d4fb
BLAKE2b-256 86ba931f7f14b25207e5e24db854010673c58109c99e8c7c80770cb61a02878f

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.2.6-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 39a99ef3921306c9085471cf4820bfbb1522e21b9a5f24612580fd03a691c489
MD5 d3ffa025d912f1719b375d33ee0d9ace
BLAKE2b-256 03ccf07eab91b0b226842403c6acace17c329560507be20acad46106d620715c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.2.6-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 202c19b406eadd060b03a11110a82585e714bfda9338f3ab4e2e9683167b9d1c
MD5 2920b846c97efcf71b73b3f6579aeb88
BLAKE2b-256 c0f7ce1e7537b0c2f3126100b04578aa26abaf069e6d5f0e0a09571a729fe08f

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