Skip to content

auto_sign_in

IvonWei edited this page Aug 5, 2020 · 38 revisions

auto_sign_in

自动签到 包含了 签到,读取收件箱未读消息 功能

验证码签到功能需安装baidu-aip

aipocr参数获取: https://cloud.baidu.com/doc/OCR/s/dk3iqnq51

    auto_sign_in:
      user-agent: <user-agent>
      command_executor: <command_executor> #暂时无用
      max_workers: 4 #线程数
      aipocr:
        app_id: <app_id>
        api_key: <api_key>
        secret_key: <secret_key>
      sites:
        <site_name>: <cookie>
        <site_name>:
          base_url: <url>
          url: <url>
          cookie: 'xxxxxxxxxxxx'
          method: [(default: get)|post|post_form|question]
          get_message: [(default: NexusPHP)|Gazelle|no]
          data:
            <name>: <regex>
            fixed:
              <name>: <value>
          succeed_regex: <regex>
          wrong_regex: <regex>

已适配站点

如 ptsites.sites 目录下存在需要的站点 只需配置相应的 主域名: cookie,例:

      sites:
        1ptba: xxxxxxxx

但是也有因cookie过期太快,而改用模拟登陆的站点,如以下两个站点:

      sites:
        hdpost:
          login:
            usernameOrEmail: xxxxxxxx
            password: xxxxxxxx
        skyey2:
          login:
            username: xxxxxxxx
            password: xxxxxxxx

m-team 二次验证 格式 otpauth://totp/:****?secret=[secret_key]&issuer=

        m-team: <cookie> #单独配置cookie时,不会进行二次验证

        m-team:
          cookie: <cookie>
          secret_key: <secret_key:> #当配置了secret_key时,如触发二次验证,则自动计算。

自定义站点

  1. 直接访问,如无网络错误或302跳转 直接返回成功 并以Gazelle方式获取未读消息
        pt1:
          url: http://pt1.com/
          cookie: 'xxxxxxxxxxxxx'
          get_message: 'Gazelle'
  1. 访问签到地址,并返回正则匹配结果
        pt2:
          url: https://pt2.com/attendance.php
          cookie: 'xxxxxxxxxx'
          succeed_regex: '这是您的第 .* 次签到,已连续签到 .* 天,本次签到获得 .* 个魔力值。|您今天已经签到过了,请勿重复刷新。'
  1. 访问答题地址,穷举答题,匹配到正确答案后保存到 ptsites\question.json 用于下次答题
        pt3:
          url: https://pt3.com/bakatest.php
          cookie: 'xxxxxxxxx'
          method: question
          succeed_regex: '连续.*天签到,获得.*点魔力值|今天已经签过到了\(已连续.*天签到\)'
          wrong_regex: '回答错误,失去 1 魔力值,这道题还会再考一次'
  1. 以post方式提交 data.fiexed 中的数据
        pt4:
          url: https://www.pt5.com/sign_in.php?action=sign_in
          cookie: 'xxxxxxxxxxxxxxxx'
          method: post
          data:
            fixed:
              action: 'sign_in'
          succeed_regex: '已连续签到.*天,此次签到您获得了.*魔力值奖励!|请不要重复签到哦!'

5.使用data中的正则从 base_url 中匹配数据,构造表单数据并以提交

        pt6:
          base_url: https://pt5.com/
          url: https://pt5.com/signed.php
          cookie: 'xxxxxxxxxxxx'
          method: post_form
          data:
            signed_timestamp: '(?<=signed_timestamp: ")\d{10}'
            signed_token: '(?<=signed_token: ").*(?=")'
          succeed_regex: '<b style="color:green;">已签到</b>|您已连续签到.*天,奖励.*积分,明天继续签到将获得.*积分奖励。'

签到结果保存在 entry['result'] 属性中

未读信息保存在 entry['messages'] 属性中

Clone this wiki locally