Skip to main content

No project description provided

Project description

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

特别鸣谢

  • Hobr 提供大量技术支持
  • woshiluo 提供大量技术支持和指导,修复很多本项目的bug
  • mikumifa 提供部分实现思路

使用方式

  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固定即可
    #此处使用内嵌js二进制运行时生成w, 你也可以自己接入生成w的逻辑函数
    w = slide.generate_w(key, gt, challenge, c, s)
    (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固定即可
    #此处使用内嵌js二进制运行时生成w, 你也可以自己接入生成w的逻辑函数
    w = click.generate_w(key, gt, challenge, c, s)
    #点选验证码生成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.3.2.tar.gz (50.0 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.3.2-cp314-cp314-win_amd64.whl (7.9 MB view details)

Uploaded CPython 3.14Windows x86-64

bili_ticket_gt_python-0.3.2-cp314-cp314-manylinux_2_38_x86_64.whl (13.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.38+ x86-64

bili_ticket_gt_python-0.3.2-cp314-cp314-macosx_11_0_arm64.whl (8.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

bili_ticket_gt_python-0.3.2-cp314-cp314-macosx_10_12_x86_64.whl (9.5 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

bili_ticket_gt_python-0.3.2-cp313-cp313-win_amd64.whl (7.4 MB view details)

Uploaded CPython 3.13Windows x86-64

bili_ticket_gt_python-0.3.2-cp313-cp313-manylinux_2_38_x86_64.whl (13.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

bili_ticket_gt_python-0.3.2-cp313-cp313-macosx_11_0_arm64.whl (8.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

bili_ticket_gt_python-0.3.2-cp313-cp313-macosx_10_12_x86_64.whl (9.1 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

bili_ticket_gt_python-0.3.2-cp312-cp312-win_amd64.whl (7.4 MB view details)

Uploaded CPython 3.12Windows x86-64

bili_ticket_gt_python-0.3.2-cp312-cp312-manylinux_2_38_x86_64.whl (13.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

bili_ticket_gt_python-0.3.2-cp312-cp312-macosx_11_0_arm64.whl (8.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bili_ticket_gt_python-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl (9.1 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bili_ticket_gt_python-0.3.2-cp311-cp311-win_amd64.whl (7.4 MB view details)

Uploaded CPython 3.11Windows x86-64

bili_ticket_gt_python-0.3.2-cp311-cp311-macosx_11_0_arm64.whl (8.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

bili_ticket_gt_python-0.3.2-cp311-cp311-macosx_10_12_x86_64.whl (9.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

bili_ticket_gt_python-0.3.2-cp310-cp310-win_amd64.whl (7.4 MB view details)

Uploaded CPython 3.10Windows x86-64

bili_ticket_gt_python-0.3.2-cp39-cp39-win_amd64.whl (7.4 MB view details)

Uploaded CPython 3.9Windows x86-64

bili_ticket_gt_python-0.3.2-cp38-cp38-win_amd64.whl (7.4 MB view details)

Uploaded CPython 3.8Windows x86-64

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2.tar.gz
Algorithm Hash digest
SHA256 93991a880d5bdf8ec06ed1b5f852d4983e93460485110945a823240af57f2750
MD5 3249f8da235463a7c1f521697ed72343
BLAKE2b-256 cc0afd85c2f1728070457864b89e0cd23addd9585c456e3c83c6909504ef8ec5

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a67191ee6411270df73faee8c64851cdebc2a4bde755e2474509148da838ae59
MD5 49fa70f43f24cf0b483826ef10ff7265
BLAKE2b-256 84244dd1f9e560bb895b1a71b05131d4767e5243c3473c9f35d846bffa1402dd

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp314-cp314-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp314-cp314-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 d8ba27d4cdd85dd6fb0db8b05d00c6cdcc18842539c44ec0a51297580c04365c
MD5 cc2bcae2d221a8b3792ee2bb6307ea81
BLAKE2b-256 02b69edb89f76fffd73d13c6ae3c27676d0187577646a8b95fb4d450e94bc600

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3559ab5be126bdcd0166e189ed53450f10261581f8d2d1585f1aa4832c6739b
MD5 5ca4d383f36259f2dd353f83f2bd6f29
BLAKE2b-256 e089f5f3fa7f1a66c920c88189dbed1d6f00b20d6848d0f3e4693eff9870b01b

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e1f38e46e14408feb09f84f2f8da4d2a9b6b88a3acb9eb214f4252ccf782ead0
MD5 d3d073e0a1b37bae5bfcaf269702fea8
BLAKE2b-256 91d7b34648ac28d426f76bb72bc2d35337a62e4843c9bb0f8c5e3171f3f4568e

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f9e11280dfc0002feeb5deed7e04227e7e5d8788ee78e8c2c437eaab4793056d
MD5 44b633ce9ba760cad052c645c249fccc
BLAKE2b-256 ae3fd6a9bc41b0b06dc8e716fa51ce9ce3d3a8471bb5c3498de2f3d4d4f96c03

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 98386e73c14558f378d3de3d4b3bc03206b3b3c84e02cfe9cb9760e80fba2b6d
MD5 33c6b4679fb28d997acac1787144e465
BLAKE2b-256 4d35cee78ef516d9cd1e3601423e3f118528d39531bb30135cf50080c93c4300

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57f03ee6bf36dbd636e99a8f2810acdd65a90f1add6c67da7792b11fb2207744
MD5 b08152af74d10e94c57480270d48a78a
BLAKE2b-256 e6e9c4687dbecb8e2f00d4a0191da11413bc58df298555d48766712463f5a2e7

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 25b0d254edccc1af7a1f724689ccbc0a3ba43a695d13772a40bc32238e48b221
MD5 a36bf697e7e6cda65777a7b0c079153a
BLAKE2b-256 23932bab04d1d7812aa8b97bc35721fe0ac1d484abe86095a80394753f8d0dc5

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1b39c28df20f44834c27bb6ed1120339ff954464c3756f58b9a2f28fb339e478
MD5 af6ebf444a58a69a6c3d14be0e7760b2
BLAKE2b-256 1fe4c7a1905ae2cba5489dba0a99b09fb8eccd91c2987e6270d5e9ae49917d23

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 2c7722323d4edf4e9e9ee2a7b546ea16f3f2f668e40721199ce1614c41ee81bd
MD5 7f6615c025e126fec7fb51363c27f5a6
BLAKE2b-256 10c5e30d617c21fd0b401bfc4c493d81f41d482c1d1d4b25e00ce87498756079

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e63be7faeb00c8de5280c0b7045b2e9480883a27bce3166fa5fc2a555e83ea3
MD5 4a2c55e1656fe05c3d69e0e0b4c1e9ce
BLAKE2b-256 5acaec80ac6d72c22e95f12b27c90d3182194225f7727925b4d23bdf6efa418a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2716ccd1d4603ef16f6d17f52feeed2f61ddf5ae721644ffca105d62422afe3d
MD5 01e5dcf4426953a0b535a2b5aa59c6de
BLAKE2b-256 13f027e50447ce3853bc21553590cb570be85081d4545d9362da55f846840a37

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e972266e4405906ec8cf61106b5edacc3b713ab3a97fc9a2a17a61170bd75bc8
MD5 e83bf29d040648f24c530350c91ccd7a
BLAKE2b-256 02e5f7ed218f17573c6ac248f0575c16422bdc009f14eb8f1bd750811aceedfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95fb189bb4ae6cf97eddc1ac22f60d998713c48e39788b8bf68ebf56e36d1dd0
MD5 f07c7cb049280c9ebfd115d81bbdcf70
BLAKE2b-256 5a0c4ab136b8839a6636140b1df4b2ff07d7e24a38d51781b61eb46d1b88ec62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 27bc6acd15f2c41e6c16bdd79267e9cefd1f251c53c4696c95f9ad6eafbb5964
MD5 f7d2e67792a6196ee6fde1b5acc3d088
BLAKE2b-256 fd3345fde610a758adefa77a3ba5cb2c173910dce138ab7911a1e21f8011b5db

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 97656c597f6ac382b91b30c0af5e643e7e7fa58f048bbc52000168134dcb0f8f
MD5 fa102bfa22ef230cecedd33906cb9eee
BLAKE2b-256 16e04e6aa1013828af4b410509189dc468540b0df3b9c8e6061b22a85082b909

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 24c4dfa4c88d712e728a4085ce933690ce1a885eb16bde4b50302f752b903d4f
MD5 98b03539fe67d4cdde6db029b700e5ef
BLAKE2b-256 c5fdbaada011abb69eb6449be8f4e7e15fbf634aa95697aa575559f3bc5f24b5

See more details on using hashes here.

File details

Details for the file bili_ticket_gt_python-0.3.2-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for bili_ticket_gt_python-0.3.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 cb59f0dd563b932576ce2aa17bb05d2cb1ee8ec59ae442ed81bcaa04192508dc
MD5 6c609b29cef26a0228260a332129f244
BLAKE2b-256 fe78568b01802ab9f8a394abde4ecaff6a6e175ce499d5b139c59a07b8f0747f

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