昔年浅巷

昔年浅巷

站点自动签到

115
2024-10-19

随着手头拥有的PT站点越来越多,管理签到和数据统计就变得十分繁琐与复杂,因此引入flexget_qbittorrent_mod项目来实现多站点签到

前置准备

获取百度OCR识别API接口参数

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

 aipocr:
        app_id: <app_id>
        api_key: <api_key>
        secret_key: <secret_key>

安装插件

  • 下载插件 master
  • 在Flexget的 config 文件夹下新建 plugins 文件夹
  • 将所有的 .py 文件 与 ptsites 文件夹 解压至 plugins 下
  • 若启用了Web-UI或守护进程,则重启flexget重新加载配置

DOCKER安装FLEXGET

## 拉取镜像
docker pull madwind/flexget

## 运行镜像
  docker run -itd \
    -p 3539:3539 \
    -e TZ:Asia/Shanghai
    #管理密码
    -e FG_WEBUI_PASSWD:<password>
    #日志级别
    -e FG_LOG_LEVEL=INFO
    -v $PWD/config/:/config \
    -v $PWD/downloads/:/downloads \
    --name flexget --restart=unless-stopped \
    madwind/flexget

安装完成后,将上面下载master压缩包文件复制到/config/plugins 目录下。

配置FLEXGET配置文件

1693548214423.webp

web_server:
  bind: 0.0.0.0
  port: 3539
      
schedules:
  - tasks: [ sign_in ]
    schedule:
      minute: 30
      hour: 7-20/11


tasks:
  #自动签到
  sign_in:
    auto_sign_in:
      user-agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36'
      max_workers: 1
      get_messages: no #设为no跳过获取未读信息。默认no
      get_details: yes #设为no跳过获取统计。默认yes      
      aipocr:  #baidu ocr参数
        app_id: 'xxxxx'
        api_key: 'xxxx'
        secret_key: 'xxxxxx'
      sites:
      #以下为具体站点设置 
      #以下为常见示例 具体以https://github.com/madwind/flexget_qbittorrent_mod/blob/master/config_example.yml#L36 下的示例为准 
      #主域名: cookie 
        hdsky:
          cookie: 'xxxxxxxxxx'
          join_date: '2023-03-17'
        ourbits:
          # ourbits 在同时配置了cookie 和 login 时,会忽略login 使用cookie签到 
          cookie: 'xxxxxxxx'
          login:
            username: 'xxxx'
            password: 'xxxxx'      
        #u2特殊设置 无此站点的请删除
        dmhy:
          username: 'xxxxx'
          cookie: 'xxxxxxx'
          # 五个字符以上签到留言
          comment: '言出法随,今天又是开心的一天!!!'
          ocr_config:
            # 重试次数
            retry: 3
            # 最低识别字符数
            char_count: 3
            # 最低匹配分数
            score: 50     
    accept_all: yes
    seen:
      fields:
        - title
    notify:
      task:
        always_send: true
        message: |+
          {%- if task.accepted -%}
          {%- for group in task.accepted|groupby('task') -%}
          FlexGet has just signed in {{ group.list|length }} sites for task {{ group.grouper }}:
          {% for entry in group.list %}
          {{ loop.index }}: {{ entry.title }} {{ entry.result }}
          {%- if entry.messages|d('') %}
          Messages: {{ entry.messages }}
          {% endif %}
          {%- endfor -%}
          {%- endfor -%}
          {%- endif -%}
          {%- if task.failed %}
          {% for group in task.failed|groupby('task') %}
          The following sites have failed for task {{ group.grouper }}:
          {% for entry in group.list %}
          {{ loop.index }}: {{ entry.title }} Reason: {{ entry.reason|d('unknown') }}
          {%- if entry.messages|d('') %}
          Messages: {{ entry.messages }}
          {% endif %}
          {%- endfor -%}
          {%- endfor -%}
          {%- endif -%}
        via: #推送渠道选择 选择你需要的推送渠道 将不需要的删掉
          # - wecom:  #微信
          #     corp_id: ''
          #     corp_secret: ''
          #     agent_id: ''
          #     to_user: ''
          #     image: 'details_report.png' 
          - telegram_mod: #tg
              bot_token: 'xxxxxxxxxxx'
              image: 'details_report.png'
              recipients:
                - username: 'xxxxxxx' #注意这里是用户名,不是昵称,不带@

手动或自动运行定时任务

1693548341436.webp

1693548441813.webp