├── .gitignore ├── 01.B站每天白嫖12硬币 ├── README.MD ├── main.py └── requirements.txt ├── 02.葫芦侠三楼签到 ├── README.MD └── main.py ├── 03.吾爱破解论坛打卡 ├── README.MD └── main.py ├── 04.Educoder每日签到拿金币 ├── README.md └── main.py ├── 05.学习通健康打卡 ├── main.py └── readme.md ├── README.MD └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /02.葫芦侠三楼签到/demo.py 2 | -------------------------------------------------------------------------------- /01.B站每天白嫖12硬币/README.MD: -------------------------------------------------------------------------------- 1 | # 活动时间 2 | 3 | 2020年8月1日—2020年9月5日 4 | 5 | # 功能介绍 6 | 7 | 配合腾讯云函数,每天白嫖12硬币 8 | 9 | # 使用方法 10 | 11 | ## 注册石墨文档并新建文件 12 | 13 | 14 | 15 | ## 获取cookie & csrf 16 | 17 | cookie有效时间应该是一个星期 18 | 19 | - 获取cookie 20 | 21 | 打开活动页面 22 | 23 | - 获取csrf 24 | 25 | 打开活动页面,点击分享按钮 26 | 27 | ## 更新cookie & csrf 28 | -------------------------------------------------------------------------------- /01.B站每天白嫖12硬币/main.py: -------------------------------------------------------------------------------- 1 | import re 2 | import json 3 | import time 4 | import requests 5 | from requests.cookies import cookiejar_from_dict 6 | 7 | 8 | class BiliBili(object): 9 | 10 | def __init__(self, cookie: str, csrf: str, sid: str): 11 | t = cookie.split("; ") 12 | self.cookie = {} 13 | for d in t: 14 | k, v = d.split("=") 15 | self.cookie[k] = v 16 | print(self.cookie) 17 | self.headers = { 18 | "Content-Type": "application/x-www-form-urlencoded", 19 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36", 20 | } 21 | self.sid = sid 22 | self.csrf = csrf 23 | self.session = requests.session() 24 | self.session.cookies = cookiejar_from_dict(self.cookie) 25 | 26 | def add_times(self, action_type): 27 | """ 28 | 增加抽奖次数的函数 29 | :param action_type: 表示获取抽奖次数的方式 3分享 4关注 30 | :return: 31 | """ 32 | # sid=dd83a687-c800-11ea-8597-246e966235d8&=3&csrf=65be4e6304047d450bab236aa16d31ec 33 | api = "https://api.bilibili.com/x/activity/lottery/addtimes" 34 | data = { 35 | "sid": self.sid, 36 | "action_type": action_type, 37 | "csrf": self.csrf 38 | } 39 | resp = self.session.post(api, headers=self.headers, data=data) 40 | print(resp.text) 41 | 42 | def lottery(self): 43 | """ 44 | 抽奖函数 45 | 参数示例 46 | sid=dd83a687-c800-11ea-8597-246e966235d8&type=1&=65be4e6304047d450bab236aa16d31ec 47 | :return: 48 | """ 49 | api = "https://api.bilibili.com/x/activity/lottery/do" 50 | data = { 51 | "sid": self.sid, 52 | "type": 1, 53 | "csrf": self.csrf 54 | } 55 | while 1: 56 | resp = self.session.post(api, headers=self.headers, data=data) 57 | if json.loads(resp.text)['code'] == 75415: 58 | break 59 | time.sleep(0.3) 60 | 61 | # code = 75415 message = "抽奖次数不足" 62 | print(resp.text) 63 | 64 | 65 | def get_cookie_and_csrf(url): 66 | resp = requests.get(url) 67 | # class="ql-code-block">(.*)(?=) 68 | data = re.findall('class="ql-code-block">(.*)(?=)', resp.text)[0] 69 | cookie, csrf = data.split("$$$") 70 | return cookie, csrf 71 | 72 | 73 | def main_handler(event=None, context=None): 74 | 75 | # 填写你的石墨文档地址,抓取cookie和csrf 76 | shimo = "https://shimo.im/docs/###/read" 77 | # 填写你的B站sid 78 | sid = "xxx" 79 | 80 | cookie, csrf = get_cookie_and_csrf(shimo) 81 | b = BiliBili(cookie, csrf, sid) 82 | b.add_times(3) 83 | time.sleep(0.3) 84 | b.add_times(4) 85 | b.lottery() 86 | print("Received event: " + json.dumps(event, indent=2)) 87 | print("Received context: " + str(context)) 88 | print("Hello world") 89 | return "Hello World" 90 | 91 | 92 | if __name__ == '__main__': 93 | main_handler() 94 | -------------------------------------------------------------------------------- /01.B站每天白嫖12硬币/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /02.葫芦侠三楼签到/README.MD: -------------------------------------------------------------------------------- 1 | # 葫芦侠三楼打卡脚本 2 | 3 | ## 简介 4 | 5 | 配合腾讯云函数,每天自动打卡(0成本) 6 | 7 | ## 使用方法 8 | 9 | -------------------------------------------------------------------------------- /02.葫芦侠三楼签到/main.py: -------------------------------------------------------------------------------- 1 | import json 2 | import hashlib 3 | import aiohttp 4 | import asyncio 5 | 6 | 7 | # 填写葫芦侠账号密码 8 | config = { 9 | "account": "###", 10 | "password": "###", 11 | } 12 | 13 | 14 | async def get_all_cate(session) -> list: 15 | category_api = "http://floor.huluxia.com/category/list/ANDROID/2.0" 16 | params = { 17 | "platform": 2, 18 | "gkey": "000000", 19 | "app_version": "4.0.0.5.3", 20 | "versioncode": "20141430", 21 | "_key": "", 22 | "device_code": "[w]02:00:00:00:00:00[d]4d7d0e99-4fc7-4cbf-8511-27df7ebb1de7", 23 | "is_hidden": 1} 24 | async with session.get(category_api, params=params) as resp: 25 | resp_dict = json.loads(await resp.text()) 26 | cate_list = [] 27 | if resp_dict["status"] == 1: 28 | for cate in resp_dict["categories"]: 29 | cate_list.append(cate["categoryID"]) 30 | return cate_list 31 | 32 | 33 | async def login(session) -> dict: 34 | """登录""" 35 | login_api = "http://floor.huluxia.com/account/login/ANDROID/4.0" 36 | account = config['account'] 37 | password = config['password'] 38 | # 密码采用的是md5加密方式 39 | hl = hashlib.md5() 40 | hl.update(password.encode(encoding="utf-8")) 41 | password = hl.hexdigest() 42 | 43 | params = { 44 | "platform": 2, 45 | "gkey": "000000", 46 | "app_version": "4.0.0.5.3", 47 | "versioncode": "20141430", 48 | "_key": "", 49 | "device_code": "[w]02:00:00:00:00:00[d]4d7d0e99-4fc7-4cbf-8511-27df7ebb1de7", 50 | } 51 | data = { 52 | 'account': account, 53 | 'password': password, 54 | 'login_type': 2 55 | } 56 | async with session.post(login_api, params=params, data=data) as resp: 57 | resp_dict = json.loads(await resp.text()) 58 | return { 59 | "status": resp_dict["status"], 60 | "_key": resp_dict["_key"] if resp_dict["status"] == 1 else "登录失败" 61 | } 62 | 63 | 64 | async def sign_in(session, key, cate_id): 65 | sign_api = "http://floor.huluxia.com/user/signin/ANDROID/2.1" 66 | params = { 67 | "platform": "2", 68 | "gkey": "000000", 69 | "app_version": "4.0.0.5.3", 70 | "versioncode": "20141430", 71 | "_key": key, 72 | "device_code": "[w]02:00:00:00:00:00[d]4d7d0e99-4fc7-4cbf-8511-27df7ebb1de7", 73 | "cat_id": cate_id, 74 | } 75 | async with session.get(sign_api, params=params) as resp: 76 | try: 77 | sign_result = json.loads(await resp.text()) 78 | except: 79 | return "请求签到API失败!" 80 | return { 81 | "cate_id": cate_id, 82 | "status": sign_result['status'], 83 | "msg": sign_result["msg"] if sign_result['status'] != 1 else "签到成功" 84 | } 85 | 86 | 87 | async def main(): 88 | async with aiohttp.ClientSession() as session: 89 | cates = await get_all_cate(session) 90 | print(set(cates)) 91 | 92 | login_resp = await login(session) 93 | key = login_resp["_key"] 94 | 95 | sign_tasks = [] 96 | for cate in cates: 97 | sign_tasks.append(asyncio.ensure_future(sign_in(session, key=key, cate_id=cate))) 98 | completed, pending = await asyncio.wait(sign_tasks) 99 | results = [t.result() for t in completed] 100 | print('results: {!r}'.format(results)) 101 | 102 | 103 | def main_handler(event=None, context=None): 104 | loop = asyncio.get_event_loop() 105 | loop.run_until_complete(main()) 106 | 107 | 108 | if __name__ == '__main__': 109 | main_handler() 110 | -------------------------------------------------------------------------------- /03.吾爱破解论坛打卡/README.MD: -------------------------------------------------------------------------------- 1 | # 吾爱破解打卡云函数 2 | 3 | 4 | # 使用方法 5 | 6 | ## 设置远程更新cookie文档地址 7 | 8 | pass 9 | 10 | -------------------------------------------------------------------------------- /03.吾爱破解论坛打卡/main.py: -------------------------------------------------------------------------------- 1 | import re 2 | import requests 3 | from requests.cookies import cookiejar_from_dict 4 | 5 | 6 | class WuAiPoJie(object): 7 | 8 | def __init__(self, cookie: str): 9 | t = cookie.split("; ") 10 | print(t) 11 | # messagetext 12 | self.cookie = {} 13 | for d in t: 14 | k, v = d.split("=", 1) 15 | self.cookie[k] = v 16 | self.headers = { 17 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36", 18 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", 19 | "Referer": "https://www.52pojie.cn/index.php" 20 | } 21 | self.session = requests.session() 22 | self.session.headers = self.headers 23 | self.session.cookies = cookiejar_from_dict(self.cookie) 24 | 25 | def sign(self): 26 | # 申请签到任务 27 | apply = "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2" 28 | # 执行签到任务 29 | draw = "https://www.52pojie.cn/home.php?mod=task&do=draw&id=2 " 30 | resp1 = self.session.get(apply, verify=False) 31 | resp2 = self.session.get(draw, verify=False) 32 | status = re.findall('
(.*)
', resp2.text) 33 | print(status[0]) 34 | 35 | 36 | def main_handler(event=None, context=None): 37 | # 填写存有cookie的石墨文档公开地址 38 | shimo = "https://shimo.im/docs/###/" 39 | resp = requests.get(shimo) 40 | cookie = re.findall('class="ql-code-block">(.*)(?=基本信息
" 82 | elif f['id'] == 6: 83 | f['fields'][0]['tip']['text'] = r"健康状况
" 84 | elif f['id'] == 36: 85 | f['fields'][0]['tip']['text'] = r"出行情况
" 86 | elif f['id'] == 8: 87 | f['fields'][0]['values'][0]['val'] = "健康 " 88 | f['fields'][0]['options'][0]['title'] = "健康 " 89 | 90 | if f['id'] in not_show: 91 | f['isShow'] = False 92 | else: 93 | f['isShow'] = True 94 | # print(form_data) 95 | return form_data 96 | 97 | def form_data_to_urlencoded(self, params: dict) -> str: 98 | """ 99 | dict -> urlencoded 100 | """ 101 | payload = parse.urlencode(params) 102 | str_form_data = str(self.form_data) 103 | str_form_data = str_form_data.replace('\'', '\"').replace('False', 'false').replace('True', 'true').replace(r"\\", "\\") 104 | payload += quote(str_form_data, 'utf-8') 105 | return payload 106 | 107 | def _edit_report(self, hid: str, enc: str) -> dict: 108 | """ 109 | 上报健康信息 110 | """ 111 | edit_api = "https://office.chaoxing.com/data/apps/forms/fore/user/edit" 112 | params = { 113 | "id": hid, 114 | "formId": "7185", 115 | "enc": enc, 116 | "gverify": "", 117 | "formData": '' 118 | } 119 | payload = self.form_data_to_urlencoded(params) 120 | resp = self._session.post(edit_api, data=payload) 121 | return json.loads(resp.text) 122 | 123 | def _daily_report(self) -> dict: 124 | """ 125 | 上报今日信息 126 | """ 127 | save_api = "http://office.chaoxing.com/data/apps/forms/fore/user/save?lookuid=127973522" 128 | params = { 129 | "formId": "7185", 130 | "formAppId": "", 131 | "version": "2", 132 | "checkCode": "", 133 | "enc": "f837c93e0de9d9ad82db707b2c27241e", 134 | "formData": "" 135 | } 136 | payload = self.form_data_to_urlencoded(params) 137 | resp = self._session.post(save_api, data=payload) 138 | return json.loads(resp.text) 139 | 140 | def _to_begin(self): 141 | """ 142 | 调用登录及健康信息获取函数 143 | """ 144 | self._login() 145 | raw_data = self._get_last_heath_info() 146 | self.form_data = self.clean_heath_info(raw_data) 147 | 148 | def edit_report(self, hid: str, enc: str) -> dict: 149 | """ 150 | 修改已上报的健康信息入口 151 | 说明:修改已上报信息的功能实际意义不大,主要是开发时测试使用 152 | :params id: 表单id 153 | :params form_data: 已编码的上次健康信息 154 | """ 155 | self._to_begin() 156 | return self._edit_report(hid, enc) 157 | 158 | def daily_report(self) -> dict: 159 | """ 160 | 健康信息上报入口 161 | """ 162 | self._to_begin() 163 | return self._daily_report() 164 | 165 | 166 | def main_handler(event, context): 167 | query: dict = event["queryString"] 168 | username, password, schoolid = query.get("name", ''), query.get("pwd", ''), query.get("schoolid", "") 169 | if not username or not password: 170 | return { 171 | "message": "账号密码不能为空" 172 | } 173 | 174 | h = HeathReport(username=username, password=password, schoolid=schoolid) 175 | result = h.daily_report() 176 | return result 177 | -------------------------------------------------------------------------------- /05.学习通健康打卡/readme.md: -------------------------------------------------------------------------------- 1 | ## 脚本介绍 2 | 3 | 学习通健康信息上报脚本 4 | 5 | - 支持腾讯云函数,无需服务器 6 | - 依赖云函数可供多人使用 7 | 8 | ## 使用方法 9 | 10 | **1、 立即使用** 11 | 12 | API接口,支持任意方式请求 13 | 14 | `https://service-m734xlwq-1259447870.gz.apigw.tencentcs.com/release/xuexitong_heath` 15 | 16 | 参数: 17 | 18 | `name`: 手机号码(必填) 19 | 20 | `pwd`: 登录密码(必填) 21 | 22 | `schoolid`: 学校id(学号登录必填) 23 | 24 | Get请求示例: 25 | 26 | `https://service-m734xlwq-1259447870.gz.apigw.tencentcs.com/release/xuexitong_heath?name=账号&pwd=密码` 27 | 28 | --- 29 | 30 | **2、搭建API** 31 | 32 | 代码已在腾讯云函数上调试可用 33 | 34 | 1. 新建腾讯云函数 35 | 36 | 2. 复制代码至`index.py` 37 | 38 | 3. 开启`API网关触发` 39 | 40 | 4. 调用API测试 41 | 42 | --- 43 | 44 | **3、仅个人使用** 45 | 46 | 1. 新建腾讯云函数 47 | 48 | 2. 复制代码至`index.py` 49 | 50 | 3. 在代码内配置个人账号密码 51 | 52 | 4. 开启`定时触发` 每天一次 -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # 简介 2 | 3 | 打卡签到云函数脚本合集 4 | 5 | # 版本 6 | 7 | Python3.6 8 | 9 | # 平台 10 | 11 | 腾讯云 12 | 13 | # 脚本列表 14 | 15 | - [x] [BiliBili抽奖](https://github.com/mkdir700/sign_in/tree/master/01.B%E7%AB%99%E6%AF%8F%E5%A4%A9%E7%99%BD%E5%AB%9612%E7%A1%AC%E5%B8%81) 16 | 17 | - [x] [葫芦侠签到](https://github.com/mkdir700/sign_in/tree/master/02.%E8%91%AB%E8%8A%A6%E4%BE%A0%E4%B8%89%E6%A5%BC%E7%AD%BE%E5%88%B0) 18 | 19 | - [x] [吾爱破解论坛打卡](https://github.com/mkdir700/sign_in/tree/master/03.%E5%90%BE%E7%88%B1%E7%A0%B4%E8%A7%A3%E8%AE%BA%E5%9D%9B%E6%89%93%E5%8D%A1) 20 | 21 | - [x] [EduCoder签到](https://github.com/mkdir700/sign_in/tree/master/04.Educoder%E6%AF%8F%E6%97%A5%E7%AD%BE%E5%88%B0%E6%8B%BF%E9%87%91%E5%B8%81) 22 | 23 | - [x] [学习通-健康上报](https://github.com/mkdir700/sign_in/tree/master/05.%E5%AD%A6%E4%B9%A0%E9%80%9A%E5%81%A5%E5%BA%B7%E6%89%93%E5%8D%A1) 24 | 25 | - [x] [学习通-课堂签到](https://github.com/mkdir700/chaoxing_auto_sign) 26 | 27 | - [x] [小One易统计打卡](https://github.com/mkdir700/OneHeathScript) -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.6.2 2 | APScheduler==3.6.3 3 | astroid==2.3.2 4 | async-timeout==3.0.1 5 | attrs==19.3.0 6 | brotlipy==0.7.0 7 | certifi==2020.6.20 8 | cffi==1.14.0 9 | chardet==3.0.4 10 | colorama==0.4.1 11 | cryptography==2.9.2 12 | Flask==1.1.1 13 | idna 14 | idna-ssl==1.1.0 15 | isort==4.3.21 16 | itsdangerous==1.1.0 17 | Jinja2==2.11.1 18 | lazy-object-proxy==1.4.3 19 | MarkupSafe==1.1.1 20 | mccabe==0.6.1 21 | multidict==4.7.6 22 | pycparser 23 | pylint==2.4.3 24 | pyOpenSSL 25 | pyqt5-tools==5.13.0.1.5 26 | PySocks==1.7.1 27 | python-dotenv==0.10.5 28 | pytz==2019.3 29 | requests 30 | six==1.15.0 31 | typing-extensions==3.7.4.2 32 | tzlocal==2.0.0 33 | urllib3 34 | Werkzeug==0.16.1 35 | win-inet-pton==1.1.0 36 | wincertstore==0.2 37 | wrapt==1.11.2 38 | yarl==1.5.1 39 | --------------------------------------------------------------------------------