├── .github └── workflows │ └── auto_sign_in.yml ├── .vscode └── launch.json ├── LICENSE.txt ├── README.md ├── config.yaml ├── config └── config.go ├── go.mod ├── go.sum ├── main.go └── platform ├── ali_cloud_disk.go ├── bilibili.go ├── jingdong.go ├── kuake.go └── pushplus.go /.github/workflows/auto_sign_in.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: alipan_auto_sign 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the "main" branch 8 | schedule: 9 | # * is a special character in YAML so you have to quote this string 10 | - cron: '11 23 * * *' 11 | workflow_dispatch: 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | 15 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 16 | jobs: 17 | # This workflow contains a single job called "build" 18 | build: 19 | # The type of runner that the job will run on 20 | runs-on: ubuntu-latest 21 | 22 | # Steps represent a sequence of tasks that will be executed as part of the job 23 | steps: 24 | 25 | - name: Setup Go 1.21.3 26 | uses: actions/setup-go@v4 27 | with: 28 | # Semantic version range syntax or exact version of Go 29 | go-version: '1.21.3' 30 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 31 | - uses: actions/checkout@v3 32 | 33 | # Runs a set of commands using the runners shell 34 | - name: auto_sign_in 35 | run: | 36 | go build && 37 | sudo chmod 777 ./autoSign && 38 | ./autoSign 39 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch Package", 9 | "type": "go", 10 | "request": "launch", 11 | "mode": "debug", 12 | "program": "D:\\xm\\alipan_auto_sign\\main.go" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | https://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2011-2019 hubin. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | https://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 阿里云盘自动签到 2 | 3 | 2023-11-02更新:不需要配置仓库secret,直接修改项目里的**config.yaml**配置文件即可 4 | 5 | 2023-11-01更新:增加京东每日签到领豆,具体操作请看https://www.xiaoliu.life/p/20231101a 6 | 7 | 2023-10-25更新:增加B站直播签到,具体操作请看https://www.xiaoliu.life/p/20231025a 8 | 9 | 10 | 相较于昨天的实现,今天下班后加了下`pushplus`微信推送,能够实时了解每天签到的情况方便refresh_token失效的时候我们更换。 11 | 12 | ### pushplus 13 | 14 | pushplus是一个专门的推送平台,利用服务号能主动给用户发消息的机制来进行推送的。 15 | 16 | 官网:[pushplus(推送加)-微信消息推送平台](https://www.pushplus.plus/) 17 | 18 | ![1](https://cdn.xiaoliu.life/tc/20231017a/1.webp) 19 | 20 | 使用的话需要登录注册且关注它的公众号后才能接收到消息推送。 21 | 22 | ![2](https://cdn.xiaoliu.life/tc/20231017a/2.webp) 23 | 24 | 登陆后会看见你自己的token,有了token后才能调用接口通过服务号给你自己发消息。 25 | 26 | ### github action 27 | 28 | 项目地址:[nibabashilkk/alipan_auto_sign: 阿里云盘每日自动签到shell脚本 (github.com)](https://github.com/nibabashilkk/alipan_auto_sign) 29 | 30 | 这个是我仓库的地址,需要你fork到自己仓库里面。 31 | 32 | ![3](https://cdn.xiaoliu.life/tc/20231017a/3.webp) 33 | 34 | fork完后到你刚刚fork的仓库创建`repository secret`,具体路径是`Settings`->`Secrets and variables`->`Actions`->`New repository secret`。 35 | 36 | ![4](https://cdn.xiaoliu.life/tc/20231017a/4.webp) 37 | 38 | 注意新建的两个secret名字一定要是`refresh_token`和`pushplus_token`。 39 | 40 | ![5](https://cdn.xiaoliu.life/tc/20231017a/5.webp) 41 | 42 | 两个密钥都填好后是下面这个样子。 43 | 44 | ![6](https://cdn.xiaoliu.life/tc/20231017a/6.webp) 45 | 46 | `refresh_token`的值是登陆后从阿里云盘的localStorage获取的,不知道怎么获取可以看看这篇文章——[阿里云盘每天自动签到,可以领超级会员 (qq.com)](https://mp.weixin.qq.com/s?__biz=Mzk0ODQwNzk1NA==&mid=2247489039&idx=1&sn=55c1d37978dfcb6f4f67cdaad0dc3b35&chksm=c3694df2f41ec4e43dd6a6a658ff9192b6014fad79d7bac25d32251efe6a443f50c1d7adb4a0&token=635348881&lang=zh_CN#rd)。 47 | 48 | `pushplus_token`则是第一步登录pushplus后显示的token。 49 | 50 | 两个参数都弄好后应该就可以运行了,可以测试下配置是否正确。 51 | 52 | ![7](https://cdn.xiaoliu.life/tc/20231017a/7.webp) 53 | 54 | 点击后会立刻执行脚本,可以点进去运行任务里查看日志。 55 | 56 | ![8](https://cdn.xiaoliu.life/tc/20231017a/8.webp) 57 | 58 | 由于我微信推送太多次了,这次就没退过去,正常情况下是像下面那样能在公众号收到消息的。 59 | 60 | ![9](https://cdn.xiaoliu.life/tc/20231017a/9.webp) 61 | 62 | 如果`refresh_token`失效的话也会推送给你提醒你更换token。 63 | 64 | ![10](https://cdn.xiaoliu.life/tc/20231017a/10.webp) 65 | 66 | refresh_token失效的话更新下secret即可。 67 | 68 | ![11](https://cdn.xiaoliu.life/tc/20231017a/11.webp) 69 | 70 | 默认是每天早上八点半运行,实际可能会到中午十二点才会运行(之前试过天气推送就会延迟)。 71 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | pushplus_token: 123456abc ## pushplus推送token 2 | refresh_token: 123456abc ## 阿里云网盘刷新token 3 | bilibili_cookie: 123456abc ## B站cookie 4 | kk_cookie: 123456abc ##夸克网盘cookie 5 | jd_cookie: 123456abc ##京东cookie -------------------------------------------------------------------------------- /config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "os" 5 | 6 | "gopkg.in/yaml.v3" 7 | ) 8 | 9 | var ConfigInstance Config 10 | 11 | var UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0" 12 | 13 | type Config struct { 14 | PushPlusToken string `yaml:"pushplus_token"` 15 | RefreshToken string `yaml:"refresh_token"` 16 | BilibiliCookie string `yaml:"bilibili_cookie"` 17 | KKCookie string `yaml:"kk_cookie"` 18 | JdCookie string `yaml:"jd_cookie"` 19 | } 20 | 21 | func init() { 22 | LoadConfig() 23 | } 24 | 25 | func LoadConfig() { 26 | confFIle, err := os.ReadFile("./config.yaml") 27 | if err != nil { 28 | panic(err.Error()) 29 | } 30 | config := Config{} 31 | yaml.Unmarshal(confFIle, &config) 32 | ConfigInstance = config 33 | } 34 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module autoSign 2 | 3 | go 1.21.3 4 | 5 | require gopkg.in/yaml.v3 v3.0.1 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 2 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 3 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 4 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "autoSign/config" 5 | "autoSign/platform" 6 | "strings" 7 | ) 8 | 9 | func main() { 10 | pushPlusToken := config.ConfigInstance.PushPlusToken 11 | refreshTokens := config.ConfigInstance.RefreshToken 12 | bilibiliCookies := config.ConfigInstance.BilibiliCookie 13 | jdCookies := config.ConfigInstance.JdCookie 14 | kkCookie := config.ConfigInstance.KKCookie 15 | if refreshTokens != "" { 16 | refreshTokenList := strings.Split(refreshTokens, ",") 17 | aliCloudDisk := &platform.AliCloudDisk{} 18 | for _, refreshToken := range refreshTokenList { 19 | aliCloudDisk.Run(pushPlusToken, refreshToken) 20 | } 21 | } 22 | if bilibiliCookies != "" { 23 | bilibiliCookieList := strings.Split(bilibiliCookies, ",") 24 | bilibili := &platform.Bilibili{} 25 | for _, bilibiliCookie := range bilibiliCookieList { 26 | bilibili.Run(pushPlusToken, bilibiliCookie) 27 | } 28 | } 29 | if jdCookies != "" { 30 | jdCookiesList := strings.Split(jdCookies, ",") 31 | jd := &platform.JD{} 32 | for _, value := range jdCookiesList { 33 | jd.Run(pushPlusToken, value) 34 | } 35 | } 36 | if kkCookie != "" { 37 | kkCookieList := strings.Split(kkCookie, ",") 38 | kk := &platform.KK{} 39 | for _, value := range kkCookieList { 40 | kk.Run(pushPlusToken, value) 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /platform/ali_cloud_disk.go: -------------------------------------------------------------------------------- 1 | package platform 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "errors" 7 | "fmt" 8 | "io" 9 | "net/http" 10 | "strconv" 11 | ) 12 | 13 | type AliCloudDisk struct { 14 | } 15 | 16 | func (AliCloudDisk *AliCloudDisk) getAccessToken(refreshToken string) (string, error) { 17 | url := "https://auth.aliyundrive.com/v2/account/token" 18 | var dataMap = make(map[string]string) 19 | dataMap["grant_type"] = "refresh_token" 20 | dataMap["refresh_token"] = refreshToken 21 | dataByte, _ := json.Marshal(dataMap) 22 | req, err := http.NewRequest("POST", url, bytes.NewReader(dataByte)) 23 | if err != nil { 24 | return "", err 25 | } 26 | req.Header.Add("Content-Type", "application/json") 27 | res, err := http.DefaultClient.Do(req) 28 | if err != nil { 29 | return "", err 30 | } 31 | defer res.Body.Close() 32 | body, err := io.ReadAll(res.Body) 33 | if err != nil { 34 | return "", err 35 | } 36 | var resMap map[string]interface{} 37 | json.Unmarshal(body, &resMap) 38 | if accessToken, ok := resMap["access_token"].(string); ok { 39 | return accessToken, nil 40 | } 41 | return "", errors.New("refreshToken过期,请更改后重试") 42 | } 43 | 44 | func (AliCloudDisk *AliCloudDisk) signIn(accessToken string) (string, error) { 45 | url := "https://member.aliyundrive.com/v1/activity/sign_in_list" 46 | data := []byte(`{ 47 | "_rx-s":"mobile" 48 | }`) 49 | request, err := http.NewRequest("POST", url, bytes.NewBuffer(data)) 50 | if err != nil { 51 | return "", err 52 | } 53 | request.Header.Add("Content-Type", "application/json") 54 | request.Header.Add("Authorization", accessToken) 55 | response, err := http.DefaultClient.Do(request) 56 | if err != nil { 57 | return "", err 58 | } 59 | defer response.Body.Close() 60 | body, err := io.ReadAll(response.Body) 61 | if err != nil { 62 | return "", err 63 | } 64 | var resMap map[string]interface{} 65 | json.Unmarshal(body, &resMap) 66 | res := resMap["result"].(map[string]interface{})["signInCount"].(float64) 67 | signInCount := strconv.FormatFloat(res, 'f', 0, 64) 68 | return signInCount, nil 69 | } 70 | 71 | func (AliCloudDisk *AliCloudDisk) getReward(accessToken string, signInCount string) (string, error) { 72 | url := "https://member.aliyundrive.com/v1/activity/sign_in_reward?_rx-s=mobile" 73 | var dataMap = make(map[string]string) 74 | dataMap["signInDay"] = signInCount 75 | dataByte, _ := json.Marshal(dataMap) 76 | req, err := http.NewRequest("POST", url, bytes.NewReader(dataByte)) 77 | if err != nil { 78 | return "", err 79 | } 80 | req.Header.Add("Content-Type", "application/json") 81 | req.Header.Add("Authorization", accessToken) 82 | res, err := http.DefaultClient.Do(req) 83 | if err != nil { 84 | return "", err 85 | } 86 | defer res.Body.Close() 87 | body, err := io.ReadAll(res.Body) 88 | if err != nil { 89 | return "", err 90 | } 91 | var resMap map[string]interface{} 92 | json.Unmarshal(body, &resMap) 93 | if reward, ok := resMap["result"].(map[string]interface{})["notice"].(string); ok { 94 | return reward, nil 95 | } 96 | return "", errors.New("获取奖励失败") 97 | } 98 | 99 | func (AliCloudDisk *AliCloudDisk) qianDao(refreshToken string) (string, string, error) { 100 | accessToken, err := AliCloudDisk.getAccessToken(refreshToken) 101 | if err != nil { 102 | return "", "", err 103 | } 104 | signInCount, err := AliCloudDisk.signIn(accessToken) 105 | if err != nil { 106 | return "", "", err 107 | } 108 | reward, err := AliCloudDisk.getReward(accessToken, signInCount) 109 | if err != nil { 110 | return "", "", err 111 | } 112 | return signInCount, reward, nil 113 | } 114 | 115 | func (AliCloudDisk *AliCloudDisk) Run(pushPlusToken string, refreshToken string) { 116 | var signInCount string 117 | var reward string 118 | var err error 119 | var pushplus = PushPlus{} 120 | var title = "阿里云盘自动签到" 121 | signInCount, reward, err = AliCloudDisk.qianDao(refreshToken) 122 | if err != nil { 123 | if err.Error() == "refreshToken过期,请更改后重试" { 124 | pushplus.Run(pushPlusToken, title, "refreshToken过期,请更改后重试") 125 | fmt.Println("refreshToken过期,请更改后重试") 126 | } else { 127 | for i := 0; i < 100; i++ { 128 | signInCount, reward, err = AliCloudDisk.qianDao(refreshToken) 129 | if err == nil { 130 | content := "签到成功,你已经签到" + signInCount + "次,本次签到奖励————" + reward 131 | fmt.Println(content) 132 | pushplus.Run(pushPlusToken, title, content) 133 | break 134 | } 135 | } 136 | } 137 | } else { 138 | content := "签到成功,你已经签到" + signInCount + "次,本次签到奖励————" + reward 139 | fmt.Println(content) 140 | pushplus.Run(pushPlusToken, title, content) 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /platform/bilibili.go: -------------------------------------------------------------------------------- 1 | package platform 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "io" 7 | "net/http" 8 | ) 9 | 10 | type Bilibili struct { 11 | } 12 | 13 | func (Bilibili *Bilibili) signIn(cookie string) (string, error) { 14 | url := "https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign" 15 | req, err := http.NewRequest("GET", url, nil) 16 | if err != nil { 17 | return "", err 18 | } 19 | req.Header.Add("Cookie", cookie) 20 | res, err := http.DefaultClient.Do(req) 21 | if err != nil { 22 | return "", err 23 | } 24 | defer res.Body.Close() 25 | body, err := io.ReadAll(res.Body) 26 | if err != nil { 27 | return "", err 28 | } 29 | var resMap map[string]interface{} 30 | json.Unmarshal(body, &resMap) 31 | code, ok := resMap["code"].(float64) 32 | if ok { 33 | if code == 0 { 34 | if text, ok := resMap["data"].(map[string]interface{})["text"].(string); ok { 35 | return text, nil 36 | } 37 | } else { 38 | if msg, ok := resMap["message"].(string); ok { 39 | return msg, nil 40 | } 41 | } 42 | } 43 | return "", errors.New("不知名错误") 44 | } 45 | 46 | func (Bilibili *Bilibili) Run(pushPlusToken string, cookie string) { 47 | var title = "B站直播签到" 48 | pushPlus := PushPlus{} 49 | res, err := Bilibili.signIn(cookie) 50 | if err != nil { 51 | pushPlus.Run(pushPlusToken, title, err.Error()) 52 | } else { 53 | pushPlus.Run(pushPlusToken, title, res) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /platform/jingdong.go: -------------------------------------------------------------------------------- 1 | package platform 2 | 3 | import ( 4 | "encoding/json" 5 | "io" 6 | "net/http" 7 | ) 8 | 9 | type JD struct { 10 | } 11 | 12 | func (JD *JD) dailySign(cookie string) (string, error) { 13 | url := "https://api.m.jd.com/client.action?functionId=signBeanAct&body=%7B%22fp%22%3A%22-1%22%2C%22shshshfp%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22referUrl%22%3A%22-1%22%2C%22userAgent%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%2C%22rnVersion%22%3A%223.9%22%7D&appid=ld&client=apple&clientVersion=10.0.4&networkType=wifi&osVersion=14.8.1" 14 | req, err := http.NewRequest("POST", url, nil) 15 | if err != nil { 16 | return "", err 17 | } 18 | req.Header.Add("Cookie", cookie) 19 | res, err := http.DefaultClient.Do(req) 20 | if err != nil { 21 | return "", err 22 | } 23 | defer res.Body.Close() 24 | body, err := io.ReadAll(res.Body) 25 | if err != nil { 26 | return "", err 27 | } 28 | var resMap map[string]interface{} 29 | if err = json.Unmarshal(body, &resMap); err != nil { 30 | return "", err 31 | } 32 | var title, content string 33 | if resMap["code"].(string) != "0" { 34 | title = "签到失败" 35 | if content, exist := resMap["errorMessage"]; exist { 36 | return title + content.(string), nil 37 | } else if content, exist := resMap["message"]; exist { 38 | return title + content.(string), nil 39 | } 40 | return "不知名错误", nil 41 | } 42 | var dailyAward map[string]interface{} 43 | if value, ok := resMap["data"].(map[string]interface{})["dailyAward"]; ok { 44 | dailyAward = value.(map[string]interface{}) 45 | } else if value, ok := resMap["data"].(map[string]interface{})["continuityAward"]; ok { 46 | dailyAward = value.(map[string]interface{}) 47 | } else if value, ok := resMap["data"].(map[string]interface{})["newUserAward"]; ok { 48 | dailyAward = value.(map[string]interface{}) 49 | } 50 | title = dailyAward["title"].(string) 51 | if value, ok := dailyAward["beanAward"]; ok { 52 | content = value.(map[string]interface{})["beanCount"].(string) + "个京豆" 53 | } else { 54 | todayAward := dailyAward["awardList"].([]interface{})[0].(map[string]interface{}) 55 | content = todayAward["beanCount"].(string) + "个京豆" 56 | } 57 | return title + content, nil 58 | } 59 | 60 | func (JD *JD) Run(pushPlusToken string, cookie string) { 61 | content, err := JD.dailySign(cookie) 62 | PushPlus := PushPlus{} 63 | if err != nil { 64 | PushPlus.Run(pushPlusToken, "京东每日签到", err.Error()) 65 | } else { 66 | PushPlus.Run(pushPlusToken, "京东每日签到", content) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /platform/kuake.go: -------------------------------------------------------------------------------- 1 | package platform 2 | 3 | import ( 4 | "autoSign/config" 5 | "encoding/json" 6 | "io" 7 | "net/http" 8 | "strconv" 9 | "strings" 10 | ) 11 | 12 | type KK struct{} 13 | 14 | func sign(kkCookie string) (msg string, err error) { 15 | url := "https://drive-m.quark.cn/1/clouddrive/capacity/growth/info?pr=ucpro&fr=pc&uc_param_str=" 16 | req, err := http.NewRequest("GET", url, nil) 17 | if err != nil { 18 | return "", err 19 | } 20 | req.Header.Set("Cookie", kkCookie) 21 | req.Header.Set("User-Agent", config.UserAgent) 22 | res, err := http.DefaultClient.Do(req) 23 | if err != nil { 24 | return "", err 25 | } 26 | defer res.Body.Close() 27 | body, err := io.ReadAll(res.Body) 28 | if err != nil { 29 | return "", err 30 | } 31 | var data map[string]interface{} 32 | json.Unmarshal(body, &data) 33 | isSign := data["data"].(map[string]interface{})["cap_sign"].(map[string]interface{})["sign_daily"].(bool) 34 | if isSign != false { 35 | a := data["data"].(map[string]interface{})["cap_sign"].(map[string]interface{}) 36 | number := a["sign_daily_reward"].(float64) / (1024 * 1024) 37 | return "今天已经签到过了,签到奖励容量" + strconv.Itoa(int(number)) + "MB", nil 38 | } 39 | signUrl := "https://drive-m.quark.cn/1/clouddrive/capacity/growth/sign?pr=ucpro&fr=pc&uc_param_str=" 40 | payload := strings.NewReader(`{` + "" + `"sign_cyclic":"True"` + "" + `}`) 41 | req, err = http.NewRequest("POST", signUrl, payload) 42 | if err != nil { 43 | return "", err 44 | } 45 | req.Header.Set("Cookie", kkCookie) 46 | req.Header.Set("User-Agent", config.UserAgent) 47 | res, err = http.DefaultClient.Do(req) 48 | if err != nil { 49 | return "", err 50 | } 51 | defer res.Body.Close() 52 | body1, err := io.ReadAll(res.Body) 53 | if err != nil { 54 | return "", err 55 | } 56 | var data1 map[string]interface{} 57 | json.Unmarshal(body1, &data1) 58 | reward := data1["data"].(map[string]interface{})["sign_daily_reward"].(float64) / 2048 59 | return "签到成功,今日签到奖励" + strconv.Itoa(int(reward)) + "MB", nil 60 | } 61 | 62 | func (KK *KK) Run(pushPlusToken, cookie string) { 63 | msg, err := sign(cookie) 64 | PushPlus := PushPlus{} 65 | if err != nil { 66 | PushPlus.Run(pushPlusToken, "夸克网盘每日签到", err.Error()) 67 | } else { 68 | PushPlus.Run(pushPlusToken, "夸克网盘每日签到", msg) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /platform/pushplus.go: -------------------------------------------------------------------------------- 1 | package platform 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "fmt" 7 | "io" 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | type PushPlus struct { 13 | } 14 | 15 | func (PushPlus *PushPlus) Run(pushPlusToken string, title string, content string) { 16 | url := "http://www.pushplus.plus/send/" 17 | var dataMap = make(map[string]string) 18 | dataMap["token"] = pushPlusToken 19 | dataMap["title"] = title 20 | dataMap["content"] = content 21 | dataByte, _ := json.Marshal(dataMap) 22 | req, _ := http.NewRequest("POST", url, bytes.NewReader(dataByte)) 23 | req.Header.Add("Content-Type", "application/json") 24 | time.Sleep(1 * time.Second) 25 | res, err := http.DefaultClient.Do(req) 26 | if err == nil { 27 | defer res.Body.Close() 28 | body, _ := io.ReadAll(res.Body) 29 | fmt.Println(string(body)) 30 | } else { 31 | fmt.Println("微信推送失败") 32 | } 33 | } 34 | --------------------------------------------------------------------------------