From 058011e917da81555b73fb3b893f8c3465c9a7ff Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Thu, 28 Dec 2023 09:28:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=9F=E7=A9=BA?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xingkong.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 xingkong.py diff --git a/xingkong.py b/xingkong.py new file mode 100644 index 0000000..c59c3d9 --- /dev/null +++ b/xingkong.py @@ -0,0 +1,67 @@ +#!/usr/bin/python3 +# -- coding: utf-8 -- +# ------------------------------- +# @Author : CodeCow +# @Time : 2023-12-28 +# @Thanks : github@wd210010 https://github.com/wd210010/just_for_happy +# ------------------------------- +# cron "0 * * *" script-path=xxx.py,tag=匹配cron用 +# const $ = new Env('星空代理签到') + +import requests, json +import os +import urllib3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + +# 青龙变量 xk_username xk_password +xk_username= os.getenv("xk_username").split('&') +xk_password = os.getenv("xk_password").split('&') + + +for i in range(len(xk_username)): + print(f'开始第{i + 1}个帐号签到') + url = 'https://www.xkdaili.com/tools/submit_ajax.ashx?action=user_login&site_id=1' + headers = { + 'Accept': 'application/json, text/javascript, */*; q=0.01', + 'Accept-Encoding': 'gzip, deflate', + 'Accept-Language': 'zh-CN,zh;q=0.9', + 'Content-Length': '50', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'Host': 'www.xkdaili.com', + 'Origin': 'https://www.xkdaili.com', + 'Proxy-Connection': 'keep-alive', + 'Referer': 'https://www.xkdaili.com/', + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'X-Requested-With': 'XMLHttpRequest', + } + data = { + 'username': f'{xk_username[i]}', + 'password': f'{xk_password[i]}', + 'remember': 1 + } + response = requests.post(url=url, headers=headers, data=data,verify=False) + cookie=str(requests.utils.dict_from_cookiejar(response.cookies)).replace(',',';').replace(':','=').replace('\'','').replace('{','').replace('}','').replace(' ','') + r = json.loads(response.text)['msg'] + print(r) + + url_sign = 'https://www.xkdaili.com/tools/submit_ajax.ashx?action=user_receive_point' + headers_sign = { + 'Accept': 'application/json, text/javascript, */*; q=0.01', + 'Accept-Encoding': 'gzip, deflate', + 'Accept-Language': 'zh-CN,zh;q=0.9', + 'Content-Length': '10', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'Cookie': cookie, + 'Host': 'www.xkdaili.com', + 'Origin': 'https://www.xkdaili.com', + 'Proxy-Connection': 'keep-alive', + 'Referer': 'https://www.xkdaili.com/main/usercenter.aspx', + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'X-Requested-With': 'XMLHttpRequest', + } + data_sign = { + 'type': 'login' + } + html_sign = requests.post(url=url_sign, headers=headers_sign, data=data_sign) + result = json.loads(html_sign.text)['msg'] + print(result) From 22895a7d3901b91f06ea49fb1da7990ca032d513 Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Thu, 28 Dec 2023 09:33:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=9F=E7=A9=BA?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xingkong.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xingkong.py b/xingkong.py index c59c3d9..ed0b45d 100644 --- a/xingkong.py +++ b/xingkong.py @@ -58,6 +58,12 @@ for i in range(len(xk_username)): 'Referer': 'https://www.xkdaili.com/main/usercenter.aspx', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', 'X-Requested-With': 'XMLHttpRequest', + 'sec-ch-ua': 'Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"Windows"', + 'sec-fetch-site': 'same-origin', + 'sec-fetch-mode': 'cors', + 'sec-fetch-dest': 'empty', } data_sign = { 'type': 'login'