{"id":13569177,"url":"https://github.com/lhllhx/PT_signin","last_synced_at":"2025-04-04T05:31:41.564Z","repository":{"id":39896928,"uuid":"335212778","full_name":"lhllhx/PT_signin","owner":"lhllhx","description":"Pt站点的自动签到和数据统计","archived":false,"fork":false,"pushed_at":"2023-10-05T15:13:56.000Z","size":62,"stargazers_count":244,"open_issues_count":1,"forks_count":113,"subscribers_count":2,"default_branch":"AliYun","last_synced_at":"2024-11-05T01:34:46.449Z","etag":null,"topics":["pt"],"latest_commit_sha":null,"homepage":"https://blog.3628688.xyz/index.php/2022/07/25/利用阿里云实现pt自动签到和数据统计/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lhllhx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-02-02T08:04:12.000Z","updated_at":"2024-11-04T17:32:15.000Z","dependencies_parsed_at":"2024-01-16T20:24:13.931Z","dependency_job_id":"3151056b-8c45-4631-bc8a-64af07cd2912","html_url":"https://github.com/lhllhx/PT_signin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhllhx%2FPT_signin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhllhx%2FPT_signin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhllhx%2FPT_signin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhllhx%2FPT_signin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lhllhx","download_url":"https://codeload.github.com/lhllhx/PT_signin/tar.gz/refs/heads/AliYun","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128702,"owners_count":20888232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pt"],"created_at":"2024-08-01T14:00:36.735Z","updated_at":"2025-04-04T05:31:41.320Z","avatar_url":"https://github.com/lhllhx.png","language":"Python","funding_links":[],"categories":["Automation"],"sub_categories":["qBittorrent Tools"],"readme":"## 阿里云云函数计费有改动，具体请查看官方公告。近期可能会迁移到华为云（但是华为云很难用），有更好的建议请移步到issues。\n\n## 当图片显示异常时，可以尝试访问[这里](https://blog.3628688.xyz/index.php/2022/07/25/利用阿里云实现pt自动签到和数据统计/)\n## 前言\n近期GitHub官方对github action签到使用趋向严格，action有毙命的风险。本项目改用阿里云函数进行签到，更加合规稳定。实测，流量费用可以抹零而免费额度完全够用，所以也不会产生费用。\n## 🌀简介\n\nPTsignin 是一个基于上游项目[flexget_qbittorrent_mod](https://github.com/IvonWei/flexget_qbittorrent_mod) 和[阿里云函数](https://www.aliyun.com/product/fc) 实现的对PT站点的自动签到和数据统计。\n\n项目地址：[lhllhx/PT_signin](https://github.com/lhllhx/PT_signin/tree/AliYun)\n\n**如果觉得本项目对你有帮助，请顺手点个`Star`吧♥**\n\n## 🎪预览\n![preview](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/preview1.jpg)\n![preview](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/preview2.jpg)\n## 💡特性\n\n- [x] **自动签到**  程序会在每天早上自动执行签到流程\n- [x] **支持同步**  自动同步上游仓库，默认开启\n- [x] **多种推送渠道**  支持通过telegram和微信来推送信息\n- [x] **多站点覆盖**  覆盖大部分内站站点和部分外站站点\n\n## ❗️用前须知\n\n使用 PTsignin 即表明，您知情并同意：\n\n- 此代码通过模拟浏览器使用 Cookies 登录pt站点页面，实现自动签到和数据统计。使用时请确保遵守站点相关规定。\n\n- 您使用PTsignin造成的一切损失，与PTsignin无关。PTsignin不会对您的任何损失负责，包括但不限于奖励回收、账号异常\n\n## 📐部署\n\n部署流程比较繁琐，请耐心看完   \n\n流程框架：  \n[1. Star 仓库（可选但是强烈建议）](#1．Star仓库)  \n[2. 获取百度ORC_Api_token](#2．获取百度ORC_Api_Token)  \n[3. 配置telegram_bot或企业微信推送](#3．配置telegram_bot或企业微信推送)  \n[4. 填写配置文件](#5．加密打包并上传至私人仓库)  \n[5. 加密打包并上传至私人仓库](#4．填写配置文件)  \n[6. 获取github_api_token](#6．获取github_api_token)  \n[7. 进入阿里云云函数并创建函数](#7．进入阿里云云函数并创建函数)  \n\n详细教程：\n\n### 1．Star仓库\n\n- 项目地址：[lhllhx/PT_signin](https://github.com/lhllhx/PT_signin)\n- 点击右上角`Star`到自己的账号下\n\n\n### 2．获取百度ORC_Api_Token\n\n打开 https://cloud.baidu.com/doc/OCR/s/dk3iqnq51 根据教程获取`app_id` `api_key` `secret_key` \n\n### 3．配置telegram_bot或企业微信推送\n\n企业微信推送:\n企业微信消息发送插件，微信可关注微工作台接收消息，不必安装企业微信  \n企业微信获取参数：https://work.weixin.qq.com/api/doc/90000/90135/90665\n\ntelegram_bot:\n官方教程：https://core.telegram.org/bots#3-how-do-i-create-a-bot  \n具体教程百度很多 这里不再详述  \n需要注意 运行项目前，必须要发一条消息（任意内容皆可）到bot里面去激活bot\n\n### 4．填写配置文件\n新建文本文件并重命名为 `config.yml` \n请根据注释填写以下配置文件，注意整体格式,不要随意删减空格\n```yml\ntasks:\n  #自动签到\n  sign_in:\n    auto_sign_in:\n      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'\n      max_workers: 1\n      get_messages: no #设为no跳过获取未读信息。默认no\n      get_details: yes #设为no跳过获取统计。默认yes      \n      aipocr:  #baidu ocr参数\n        app_id: ''\n        api_key: ''\n        secret_key: ''\n      sites:\n      #以下为具体站点设置 \n      #以下为常见示例 具体以https://github.com/madwind/flexget_qbittorrent_mod/blob/master/config_example.yml#L36 下的示例为准 \n      #主域名: cookie \n        1ptba: xxxxxxxx\n      #部分cookie过期太快，而改用模拟登陆的站点，如以下站点 无此站点的请删除，请删除\n        filelist:\n          login:\n            username: xxxxxxxx\n            password: xxxxxxxx\n        hdpost:\n          login:\n            usernameOrEmail: xxxxxxxx\n            password: xxxxxxxx\n        ourbits:\n          # ourbits 在同时配置了cookie 和 login 时，会忽略login 使用cookie签到 \n          cookie: xxxxxxxx\n          login:\n            username: xxxxxxxx\n            password: xxxxxxxx\n        skyey2:\n          login:\n            username: xxxxxxxx\n            password: xxxxxxxx\n        m-team:\n          secret_key: \u003csecret_key\u003e\n          #二次验证, 扫描二维码得到文本 otpauth://totp/*****:****?secret=[secret_key]\u0026issuer=***** (只取[secret_key]部分)\n          login:\n            username: 'xxxxxxxx'\n            password: 'xxxxxxxx'\n           \n        #u2特殊设置 无此站点的请删除\n        dmhy:\n          username: \u003cusername\u003e\n          cookie: 'xxxxxxx'\n          # 五个字符以上签到留言\n          comment: \u003ccomment\u003e\n          ocr_config:\n            # 重试次数\n            retry: 3\n            # 最低识别字符数\n            char_count: 3\n            # 最低匹配分数\n            score: 50     \n    accept_all: yes\n    seen:\n      fields:\n        - title\n    notify:\n      task:\n        always_send: true\n        message: |+\n          {%- if task.accepted -%}\n          {%- for group in task.accepted|groupby('task') -%}\n          FlexGet has just signed in {{ group.list|length }} sites for task {{ group.grouper }}:\n          {% for entry in group.list %}\n          {{ loop.index }}: {{ entry.title }} {{ entry.result }}\n          {%- if entry.messages|d('') %}\n          Messages: {{ entry.messages }}\n          {% endif %}\n          {%- endfor -%}\n          {%- endfor -%}\n          {%- endif -%}\n          {%- if task.failed %}\n          {% for group in task.failed|groupby('task') %}\n          The following sites have failed for task {{ group.grouper }}:\n          {% for entry in group.list %}\n          {{ loop.index }}: {{ entry.title }} Reason: {{ entry.reason|d('unknown') }}\n          {%- if entry.messages|d('') %}\n          Messages: {{ entry.messages }}\n          {% endif %}\n          {%- endfor -%}\n          {%- endfor -%}\n          {%- endif -%}\n        via: #推送渠道选择 选择你需要的推送渠道 将不需要的删掉\n          - wecom:  #微信\n              corp_id: ''\n              corp_secret: ''\n              agent_id: ''\n              to_user: ''\n              image: 'details_report.png' \n          - telegram_mod: #tg\n              bot_token: ''\n              image: 'details_report.png'\n              recipients:\n                - username: '' #注意这里是用户名，不是昵称,不带@\n        \n```\n### 5．打包并上传至私人仓库\n5.1 将其配置文件压缩成为 `.zip` 压缩文件，压缩文件命名为config.zip\n\n5.2 新建私人仓库，并将其命名为PT_signin_data 上传压缩文件\n![new](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/new1.jpg)\n![new](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/new2.jpg)\n![new](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/new3.jpg)\n![new](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/upload.jpg)\n### 6．获取github_api_token\n见下图  \n\n![token](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/token1.png)\n![token](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/token2.png)\n![token](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptsignin/token3.png)  \n\n### 7. 进入阿里云云函数并创建函数\n\n7.1创建函数\n\n登录后打开[阿里云云函数控制台](https://fcnext.console.aliyun.com/)并开通服务\n\n打开[香港地区控制台](https://fcnext.console.aliyun.com/cn-hongkong/services)并创建函数 如下图示\n\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali1.jpg)\n\n选择对应配置\n\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali2.jpg)\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali4.jpg)\n复制文件 https://github.com/lhllhx/PT_signin/raw/AliYun/index.py 内所有内容并覆盖到云函数的编辑框并部署\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali5.jpg)\n\n填写环境变量`github_date_repository`和`github_token`\ngithub_date_repository： 你存储zip的私人仓库全名 格式为`你的用户名/仓库名` 如：`abc/PT_signin_data`  \ngithub_token：`你的github_token` 如：`ghp_abcdabcdabcdacbd`  \n\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali6.jpg)\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali7.jpg)\n\n7.2安装依赖\n\n创建层并在线安装依赖 依赖列表见 https://github.com/lhllhx/PT_signin/raw/AliYun/requirements.txt\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali8.jpg)\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali9.jpg)\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali10.jpg)\n创建完成后选上\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali11.jpg)\n7.3修改超时时间为180秒，如站点较多 可能需要进一步加长\n ![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali12.jpg)\n7.4回到配置主页面 点击测试函数 运行时间较长 请耐心等待 如运行正常则可下一步\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali13.jpg)\n7.5添加定时触发器\n![ali](https://raw.githubusercontent.com/lhllhx/Blog/master/img/ptnote/ali14.jpg)\n\n恭喜 到此部署完毕\n## 🔍结果\n\n当你完成上述流程，可以在调用日志查看部分运行日志  \n\n私人仓库里的压缩包也有部分运行日志可供参考。  \n\n注意：运行通过并不代表配置完全没有问题，请以最终结果和日志为准。\n\n## 💰计费相关\n~计算资源免费额度完全可以覆盖。流量费用，经过实测 阿里云云函数流量账单会每天结算一次，只要一个小时内未达到0.01元则费用会被抹零。本项目一次只使用了不到0.001元，无需担心产生计费~\n阿里云计费有变动 请以实际为准\n\n## 🔄同步\n\n因为接口请求上可能发生一些变化，所以上游源代码需要作出更改来适配这些变化，如果你没有及时同步项目源代码，可能会导致签到失败。 本项目默认开启自动同步.   \n\n项目默认使用分支 [lhllhx/flexget_qbittorrent_mod](https://github.com/lhllhx/flexget_qbittorrent_mod) ，该分支会自动每隔数小时同步上游项目[flexget_qbittorrent_mod](https://github.com/IvonWei/flexget_qbittorrent_mod)\n\n\n⚠️开启自动同步后存在的风险：\n\u003e开发者账号泄露后，用户会被供应链攻击的风险。用户在使用本软件时应该默认进行代码审查，然后手动在自己的Repo里PR进行更新。现在的则跳过了这一用户授权更新的动作。   \n  \n若你不想承担自动同步带来的可能的风险，请自行修改，审查和更新上游项目\n\n- 如果你看不懂上面是什么意思，不用理会即可\n\n\n## 📌其他事项和常见问题\n\n1.本项目基于[flexget_qbittorrent_mod](https://github.com/IvonWei/flexget_qbittorrent_mod)制作，对其使用有相关疑问可以在原项目提出  \n2.原项目相关wiki：[auto_sign_in](https://github.com/IvonWei/flexget_qbittorrent_mod/wiki/auto_sign_in) [wecom](https://github.com/IvonWei/flexget_qbittorrent_mod/wiki/wecom)遇到相关问题可以自行查阅  \n3.使用tg机器人发送消息时，第一次运行项目前，必须由你发送一条消息到bot，从发送消息到运行程序不能间隔过久（仅首次运行需要）  \n4.使用tg机器人发送消息时，请注意不是所有人都有用户名（username），请自行了解你是否有用户名  \n5.因原项目限制，一天只能推送一次，如果想重复测试，请删除私人仓库里的压缩文件并重新上传  \n6.由于阿里云的未知bug，请不要频繁测试函数 每次测试请间隔1分钟\n## 📑协议\n使用 PTsignin 即表明，您知情并同意：\n- 此代码通过模拟浏览器使用 Cookies 登录pt站点页面，实现自动签到和数据统计。使用时确保遵守站点相关规定。\n- 您使用PTsignin造成的一切损失，与PTsignin无关。\n- 用户之 Cookie 被储存于 Github 与 阿里云 服务器。若 Github 或 阿里云 服务器被攻破，则您的 Cookie 有遭到泄露的风险。禁用自动同步的情况下，开发者无权获取您的 Cookie\n\n## ❤️感谢\n本项目基于项目[flexget_qbittorrent_mod](https://github.com/IvonWei/flexget_qbittorrent_mod)建立，感谢其所作出的贡献。\n\n\n## Star\n\n[![Stargazers over time](https://starchart.cc/lhllhx/PT_signin.svg)](https://starchart.cc/lhllhx/PT_signin)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhllhx%2FPT_signin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flhllhx%2FPT_signin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhllhx%2FPT_signin/lists"}