更新 叮叮联盟_api.py
This commit is contained in:
parent
6f8ae3b1df
commit
70670de652
@ -1,5 +1,5 @@
|
||||
# --------------------------------注释区--------------------------------
|
||||
# 入口:http://nmub7w.jlnrj.cn?mid=1786918&r=OKgDUXIa&e=1730731520
|
||||
# 入口:http://ghpuy2w5.imedq.cn?mid=1786918&r=6uv9umK5&e=1731916630
|
||||
#
|
||||
# 需抓取数据:
|
||||
# * 填写穿透出来的api接口
|
||||
@ -8,6 +8,16 @@
|
||||
#
|
||||
# 变量名:yuanshen_api
|
||||
#
|
||||
# 如需自动提现 填写wxpusher的apptoken到 yuanshen_apptoken
|
||||
# 使用接受推送的微信号关注你自己的主题填写uid到 yuanshen_wxpusheruid
|
||||
# uid 可以在wxpusher微信公众号 下方我的-我的uid找到
|
||||
# 不需可不填
|
||||
#
|
||||
# !!!!因自己填写错误导致口令被盗或丢失一概不负责!!!
|
||||
# !!!!因自己填写错误导致口令被盗或丢失一概不负责!!!
|
||||
# !!!!因自己填写错误导致口令被盗或丢失一概不负责!!!
|
||||
# !!!!因自己填写错误导致口令被盗或丢失一概不负责!!!
|
||||
# !!!!因自己填写错误导致口令被盗或丢失一概不负责!!!
|
||||
# --------------------------------祈求区--------------------------------
|
||||
# _ooOoo_
|
||||
# o8888888o
|
||||
@ -32,6 +42,7 @@
|
||||
# 佛祖保佑 永无BUG
|
||||
# 佛祖镇楼 BUG辟邪
|
||||
# --------------------------------代码区--------------------------------
|
||||
from functools import wraps
|
||||
import requests
|
||||
import time
|
||||
import os
|
||||
@ -48,11 +59,11 @@ from datetime import datetime,timedelta
|
||||
import re
|
||||
logging.basicConfig(level=logging.INFO, format='[%(levelname)s] ===> %(message)s')
|
||||
code = "叮叮联盟_api版"
|
||||
ver = "1.6"
|
||||
ver = "1.8"
|
||||
envname = "yuanshen_api"
|
||||
|
||||
debug = False #debug模式 开启即从脚本内部获取环境变量
|
||||
debugcookie = "" #debug模式cookie
|
||||
debugcookie = "127.0.0.1:5000" #debug模式cookie
|
||||
|
||||
is_bulletin = False #公告开关
|
||||
is_toulu = False #偷撸公告开关
|
||||
@ -71,7 +82,27 @@ def get_sm():
|
||||
except:
|
||||
logging.error("联网获取检测文章列表失败!")
|
||||
bizlist = []
|
||||
|
||||
def retry(exceptions = Exception, tries=5, delay=2, backoff=2):
|
||||
"""
|
||||
简单的重试 module,如果重试失败则抛出错误。
|
||||
"""
|
||||
def decorator(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
# 每次调用时初始化独立的重试计数和延迟时间
|
||||
_tries, _delay = tries, delay
|
||||
while _tries > 1:
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except exceptions as e:
|
||||
print(f"发生错误:[{e}], Retrying in {_delay} seconds ...")
|
||||
time.sleep(_delay)
|
||||
_tries -= 1
|
||||
_delay *= backoff
|
||||
# 最后一次尝试
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
||||
return decorator
|
||||
class env():
|
||||
"""
|
||||
env模块,获取cookie并转成列表,统计时间,提示脚本开始结束,检测一些配置,try except异常处理
|
||||
@ -248,23 +279,53 @@ class yuanshen:
|
||||
self.bz = cookie['wxname']
|
||||
logging.info(f'[{self.bz}]开始运行')
|
||||
|
||||
def get_f(self):
|
||||
if os.path.exists(f'ddlm.json'):
|
||||
j = json.load(open('ddlm.json','r'))
|
||||
for i in j:
|
||||
if i['Wxid'] == self.Wxid:
|
||||
return i['f']
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def login(self):
|
||||
f = self.get_f()
|
||||
if not f:
|
||||
f = env().random_str(charset='1234567abcdef',length=32, to_lower=True)
|
||||
if os.path.exists('ddlm.json'):
|
||||
with open('ddlm.json', 'r', encoding='utf-8') as file:
|
||||
d = json.load(file)
|
||||
else:
|
||||
d = []
|
||||
|
||||
d.append({'Wxid': self.Wxid, 'f': f})
|
||||
|
||||
with open('ddlm.json', 'w', encoding='utf-8') as file:
|
||||
json.dump(d, file, indent=4)
|
||||
|
||||
headers = {
|
||||
'User-Agent': ua,
|
||||
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
|
||||
'Content-Type': 'application/json',
|
||||
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
||||
'sec-ch-ua-mobile': '?1',
|
||||
'Authorization': 'Bearer',
|
||||
'F-RTYFGHVBN': '0cb5cc12b50dddc84c3066433e88194f',
|
||||
'sec-ch-ua-platform': '"Android"',
|
||||
'Origin': 'http://bsdspbkbbt.r8it3o.cn',
|
||||
'X-Requested-With': 'com.tencent.mm',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Referer': 'http://bsdspbkbbt.r8it3o.cn/',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
"Host": "api.jiudingliliang.com",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Length": "28",
|
||||
"F-RTYFGHVBN": "",
|
||||
"Authorization": "Bearer",
|
||||
"sec-ch-ua-platform": "\"Android\"",
|
||||
"sec-ch-ua": "\"Chromium\";v=\"130\", \"Android WebView\";v=\"130\", \"Not?A_Brand\";v=\"99\"",
|
||||
"sec-ch-ua-mobile": "?1",
|
||||
"User-Agent": "Mozilla/5.0 (Linux; Android 14; 23113RKC6C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.6723.73 Mobile Safari/537.36 XWEB/1300057 MMWEBSDK/20240301 MMWEBID/4020 MicroMessenger/8.0.48.2580(0x28003035) WeChat/arm64 Weixin Android Tablet NetType/WIFI Language/zh_CN ABI/arm64",
|
||||
"X-NIUBILITY-Y": "",
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "*/*",
|
||||
"Origin": "http://9henipq.ewr919.top",
|
||||
"X-Requested-With": "com.tencent.mm",
|
||||
"Sec-Fetch-Site": "cross-site",
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Dest": "empty",
|
||||
"Referer": "http://9henipq.ewr919.top/",
|
||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"
|
||||
}
|
||||
|
||||
|
||||
@ -279,44 +340,67 @@ class yuanshen:
|
||||
url = requests.post(self.apiurl+'/loginbyweb',json=data).json()['url']
|
||||
#print(url)
|
||||
|
||||
|
||||
h = {
|
||||
'User-Agent': ua,
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/wxpic,image/tpg,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
|
||||
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
||||
'sec-ch-ua-mobile': '?1',
|
||||
'sec-ch-ua-platform': '"Android"',
|
||||
'upgrade-insecure-requests': '1',
|
||||
'x-requested-with': 'com.tencent.mm',
|
||||
'sec-fetch-site': 'none',
|
||||
'sec-fetch-mode': 'navigate',
|
||||
'sec-fetch-user': '?1',
|
||||
'sec-fetch-dest': 'document',
|
||||
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
'priority': 'u=0, i',
|
||||
"sec-ch-ua": "\"Chromium\";v=\"130\", \"Android WebView\";v=\"130\", \"Not?A_Brand\";v=\"99\"",
|
||||
"sec-ch-ua-mobile": "?1",
|
||||
"sec-ch-ua-platform": "\"Android\"",
|
||||
"upgrade-insecure-requests": "1",
|
||||
"user-agent": ua,
|
||||
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/wxpic,image/tpg,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"x-requested-with": "com.tencent.mm",
|
||||
"sec-fetch-site": "none",
|
||||
"sec-fetch-mode": "navigate",
|
||||
"sec-fetch-user": "?1",
|
||||
"sec-fetch-dest": "document",
|
||||
"accept-encoding": "gzip, deflate, br, zstd",
|
||||
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
||||
"priority": "u=0, i"
|
||||
}
|
||||
r = requests.get(url,headers=h,allow_redirects=False)
|
||||
#print(r.headers)
|
||||
token = r.headers['Location'].split('token=')[1]
|
||||
self.h = {
|
||||
domain = urlparse(r.headers['Location']).netloc
|
||||
h = {
|
||||
'User-Agent': ua,
|
||||
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
|
||||
'Content-Type': 'application/json',
|
||||
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
||||
'sec-ch-ua-mobile': '?1',
|
||||
'F-RTYFGHVBN':'',
|
||||
'Authorization': f'Bearer {token}',
|
||||
'X-NIUBILITY-Y': '',
|
||||
'F-RTYFGHVBN': env().random_str(length=32,to_lower=True),
|
||||
'sec-ch-ua-platform': '"Android"',
|
||||
'Origin': 'http://rdecfgw.cecua.cn',
|
||||
'sec-ch-ua': '"Chromium";v="130", "Android WebView";v="130", "Not?A_Brand";v="99"',
|
||||
'sec-ch-ua-mobile': '?1',
|
||||
'Origin': f'http://{domain}',
|
||||
'X-Requested-With': 'com.tencent.mm',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Referer': 'http://rdecfgw.cecua.cn/',
|
||||
'Referer': f'http://{domain}/',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
}
|
||||
r = requests.post('https://api.jiudingliliang.com/domain/use',headers=h).json()
|
||||
print(r)
|
||||
data = {
|
||||
'scene': 'INDEX',
|
||||
}
|
||||
url = 'https://api.jiudingliliang.com/domain/pool'
|
||||
r = requests.post(url,json=data,headers=h).json()
|
||||
doamin2 = r["result"]["host"]
|
||||
self.h = {
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 14; 23113RKC6C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.6723.73 Mobile Safari/537.36 XWEB/1300057 MMWEBSDK/20240301 MMWEBID/4020 MicroMessenger/8.0.48.2580(0x28003035) WeChat/arm64 Weixin Android Tablet NetType/WIFI Language/zh_CN ABI/arm64',
|
||||
'F-RTYFGHVBN': f,
|
||||
'Authorization': f'Bearer {token}',
|
||||
'sec-ch-ua-platform': '"Android"',
|
||||
'sec-ch-ua': '"Chromium";v="130", "Android WebView";v="130", "Not?A_Brand";v="99"',
|
||||
'sec-ch-ua-mobile': '?1',
|
||||
'Origin': f'{doamin2}',
|
||||
'X-Requested-With': 'com.tencent.mm',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Referer': f'{doamin2}/',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||
}
|
||||
|
||||
r = requests.post('https://api.jiudingliliang.com/user/info',json={},headers=self.h).json()
|
||||
if r['code'] == 10000:
|
||||
logging.info(f'登录成功')
|
||||
@ -324,7 +408,7 @@ class yuanshen:
|
||||
logging.info(f'登录成功')
|
||||
else:
|
||||
logging.info(f'获取阅读入口失败[{r}]')
|
||||
|
||||
@retry()
|
||||
def get_readtime(self,url):
|
||||
h = {
|
||||
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
@ -354,6 +438,7 @@ class yuanshen:
|
||||
return False,date_string
|
||||
else:
|
||||
return True,date_string
|
||||
@retry()
|
||||
def getread(self):
|
||||
url = 'https://api.jiudingliliang.com/task/read-batch'
|
||||
data = {"u": 1}
|
||||
@ -400,7 +485,7 @@ class yuanshen:
|
||||
data = {"url":self.read_url}
|
||||
r = requests.post(url,json=data).json()
|
||||
logging.info(f"遇到检测文章:推送结果[{r}]")
|
||||
|
||||
@retry()
|
||||
def read(self):
|
||||
#print(self.k)
|
||||
|
||||
@ -441,7 +526,7 @@ class yuanshen:
|
||||
return True
|
||||
else:
|
||||
logging.error(f'阅读失败[{r}]')
|
||||
|
||||
@retry()
|
||||
def userinfo(self):
|
||||
url = 'https://api.jiudingliliang.com/user/info'
|
||||
r = requests.post(url,json={},headers=self.h).json()
|
||||
@ -452,41 +537,72 @@ class yuanshen:
|
||||
url = 'https://api.jiudingliliang.com/user/withdraw'
|
||||
r = requests.post(url,headers=self.h,json={}).json()
|
||||
|
||||
# if r['code'] == 10000:
|
||||
# lessmoney = r["result"]["transfer"][0]["m"]
|
||||
# if m >= lessmoney:
|
||||
# url = 'https://api.jiudingliliang.com/user/transfer'
|
||||
# data = {'amount':lessmoney}
|
||||
# r = requests.post(url,json=data,headers=self.h).json()
|
||||
# if r['code'] == 10000:
|
||||
# logging.info(f'提现成功')
|
||||
# else:
|
||||
# logging.error(f'提现失败[{r}]')
|
||||
# else:
|
||||
# logging.info(f'余额不足,跳过提现')
|
||||
if r['code'] == 10000:
|
||||
if appToken and uid:
|
||||
lessmoney = r["result"]["transfer"][0]["m"]
|
||||
if m >= lessmoney:
|
||||
url = 'https://api.jiudingliliang.com/user/transfer'
|
||||
data = {'amount':lessmoney, 'type':'alipay'}
|
||||
r = requests.post(url,json=data,headers=self.h).json()
|
||||
logging.info(r)
|
||||
if r['code'] == 10000:
|
||||
logging.info(f'提现成功[{r}]')
|
||||
kl = r["result"]["alipay_kl"]
|
||||
data = {
|
||||
"appToken":appToken,
|
||||
"content":f'叮叮联盟提现成功,口令[{kl}]',
|
||||
"summary":f'叮叮联盟提现成功,口令[{kl}]',
|
||||
"contentType":1,
|
||||
"uids":[
|
||||
uid
|
||||
],
|
||||
"verifyPayType":0
|
||||
}
|
||||
r = requests.post('https://wxpusher.zjiecode.com/api/send/message',json=data).json()
|
||||
if r['code'] == 1000:
|
||||
logging.info('通知已发送')
|
||||
else:
|
||||
logging.error('通知发送失败')
|
||||
else:
|
||||
logging.error(f'提现失败[{r}]')
|
||||
else:
|
||||
logging.info(f'余额不足,跳过提现')
|
||||
else:
|
||||
logging.info(f'未设置wxpusher信息,跳过提现')
|
||||
else:
|
||||
logging.error(f'获取用户信息失败[{r}]')
|
||||
|
||||
|
||||
def main(self):
|
||||
self.login()
|
||||
if self.getread():
|
||||
print('='*30)
|
||||
while self.read():
|
||||
time.sleep(random.randint(0,1))
|
||||
else:
|
||||
logging.error('获取阅读入口失败')
|
||||
try:
|
||||
self.login()
|
||||
if self.getread():
|
||||
print('='*30)
|
||||
while self.read():
|
||||
time.sleep(random.randint(0,1))
|
||||
else:
|
||||
logging.error('获取阅读入口失败')
|
||||
|
||||
self.userinfo()
|
||||
self.userinfo()
|
||||
except Exception as e:
|
||||
logging.error(f'发生错误[{e}]')
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ua = os.getenv("yuanshen_useragent")
|
||||
#ua = 'Mozilla/5.0 (Linux; Android 14; 23113RKC6C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/126.0.6478.188 Mobile Safari/537.36 XWEB/1260183 MMWEBSDK/20240301 MMWEBID/98 MicroMessenger/8.0.48.2580(0x28003035) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64'
|
||||
if not ua:
|
||||
logging.info("不填ua玩你妹妹\n"*999)
|
||||
exit()
|
||||
appToken = ''
|
||||
topicIds = ''
|
||||
if not appToken or not topicIds:
|
||||
appToken = os.getenv('yuanshen_apptoken')
|
||||
uid = os.getenv('yuanshen_wxpusheruid')
|
||||
if not appToken or not uid:
|
||||
logging.error("❌你还没有设置推送,请设置环境变量:yuanshen_wxpusheruid 和 yuanshen_apptoken")
|
||||
appToken = None
|
||||
uid = None
|
||||
env().main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user