Skip to main content

a tool which signs your bars on Baidu Tieba

Project description

用 Python 实现的贴吧签到助手


$ sudo pip install mpsign


MPSIGN 的所有核心功能均在 mpsign.core 模块下(很快就不在了)。以下是一些示例。

  • 登录

    • 通过 BDUSS

      >>> from mpsign.core import User
      >>> user = User('YOUR BDUSS')  # 此处的 BDUSS 可从 * 域下的 Cookies 找到
    • 通过账号密码 (复活!!)

      from mpsign.core import User, Captcha, LoginFailure
      get_my_user = User.login('USERNAME', 'PASSWORD')  # 登陆的接口是用 generator 实现的
          result = get_my_user.send(None)  # 启动 generator
          if isinstance(result, Captcha):  # 是否需要验证码
              result.as_file('captcha.gif')  # 验证码图片保存到 captcha.gif
              user = get_my_user.send(input('captcha: '))  # 发送验证码给 generator
              user = result  # 不需要验证码的话,result 即是新建的 User 实例
      except LoginFailure as ex:
          raise ex

      注: LoginFailure 还有如下子异常: InvalidPassword, InvalidCaptcha, InvalidUsername, DangerousEnvironment

      注: user = user_gen.send(your_input) 也等价与以下代码:

      result.fill(your_input)  # result 是一个 Captcha 对象
  • 获取喜欢的吧

    >>> user.bars[0].kw
  • 签到

    >>> from mpsign.core import User, Bar
    >>> user = ...获取 User 实例
    >>> bar = Bar(kw='python')
    >>> bar.sign(user)
    SignResult(message='ok', exp=8, bar=<Bar: python>, code=0, total_sign='41', rank='3249', cont_sign='4')

    注: user.sign(bar)bar.sign(user) 等价。

    >>> [user.sign(bar) for bar in user.bars]
    ...a list of SignResult

    注: 签到需要贴吧的 fid。最好不要用 Bar(kw) 这个构造方法,会单独获取 fid。请权衡用 user.bars 批量获取和单独获取的利弊再用

  • BDUSS 吼不吼啊?

    >>> from mpsign.core import User
    >>> User('已过期或滚键盘出来的 BDUSS').validation
  • tbs

    >>> user.tbs
  • fid

    >>> from mpsign.core import Bar
    >>> Bar('chrome').fid


MPSIGN 自带一个命令行工具!配合 Cron 食用效!果!更!佳!(〜 ̄△ ̄)〜


$ mpsign login 用户名
$ mpsign sign


$ mpsign --help
  mpsign login <username> [--dont-update]
  mpsign (new|set) <user> <bduss> [--without-verifying] [--dont-update]
  mpsign (delete|update) [<user>]
  mpsign sign [<user>] [--delay=<second>]
  mpsign info [<user>]
  mpsign -h | --help
  mpsign -v | --version

  -h --help             Show this screen.
  -v --version          Show version.
  --without-verifying   Do not verify BDUSS.
  --dont-update         Do not update your favorite bars after binding user
  --bduss               Your Baidu BDUSS.
  --username            Your Baidu ID
  --user                Your mpsign ID.
  --delay=<second>      Delay for every single bar [default: 3].

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

mpsign-1.5.4.tar.gz (13.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page