不知道任推邦是啥的,可以查看之前的文章:夸克网盘扩容N次20T的方法
本文主要是针对夸克网盘的,其他项目有的没有提供接口,如果有也自行抓包,参考修改一下就行了。主要是将接口返回内容以html表格形式进行推送,可以极其清晰的看出你的数据有多惨淡哈哈。
采集范围:近30条
效果图:
刚好最近切换推送平台,也当做演示如何写推送代码吧。
以下是PushPlus推送的完整代码:
import requests,json,time
push_token = '' #pushplus的token
push_title = '任推邦' #推送标题
push_content = '偶尔敲代码' #推送内容
tgm = '100XXXXXXXXX'#夸克网盘推广码,其余的接口不一样
def pushplus_send():
data = {
"token": push_token,
"title": push_title,
"content": push_content,
"template": "html"}
body = json.dumps(data).encode(encoding='utf-8')
response = requests.post('http://www.pushplus.plus/send', data=body)
print(response.text)
url = "https://dt.bd.cn/main/quark_list"
headers = {
"Host": "dt.bd.cn",
"Connection": "keep-alive",
"Content-Length": "15",
"Accept": "*/*",
"X-Requested-With": "XMLHttpRequest",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 NetType/WIFI MicroMessenger/7.0.20.1781(0x6700143B) WindowsWechat(0x6309092b) XWEB/9105 Flue",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Origin": "https://dt.bd.cn",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://dt.bd.cn/main/quark_list",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9"}
body = f'bs={tgm}'
response = requests.post(url=url, data=body, headers=headers)
#print(response.text)
try:
aaa = json.loads(response.text)
if aaa['msg'] == 'ok' :
print(f'获取成功')
i = 0
html_code = "<table>\n<tr>\n<th>日期</th>\n<th>手机拉新 </th>\n<th>PC拉新 </th>\n<th>转存数 </th>\n<th>会员分成 </th>\n</tr>\n"
for list in aaa['data']['list']:
#print(list['date_str'],list['mobile_count'],list['pc_count'],list['store_count'],list['mobile_fencheng'])
html_code += "<tr>\n"
html_code += f"<td style='border: 1px solid black;'>{list['date_str']} </td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['mobile_count']}</td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['pc_count']}</td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['store_count']}</td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['mobile_fencheng']}</td>\n"
html_code += "</tr>\n"
i = i + 1
if i >30 :# 取30条 {"code":999,"msg":"发送内容过大,不能超过2万字","data":null}
break
html_code += "</table>"
push_content=html_code
pushplus_send()
else:
print(f'获取失败')
except Exception:
print(response.text)
以下是WxPusher推送的完整代码:
import requests,json,time
push_token = 'UID_RXXXXX' #wxpusher的UID
push_title = '任推邦' #推送标题
push_content = '偶尔敲代码' #推送内容
tgm = '1000XXXXXX'#夸克网盘推广码,其余的接口不一样
wxapp_token = 'AT_XXXXXX' #wxpusher的APPTOKEN
def wxpusher_send():
headers = {'Content-Type': 'application/json;charset=utf-8'}
data = {
"appToken": wxapp_token,
"uids": [f"{push_token}"],
"topicIds": [],
"summary": push_title,
"content": push_content,
"contentType": 2,
"verifyPay": False
}
json_data = json.dumps(data)
response = requests.post('https://wxpusher.zjiecode.com/api/send/message', headers=headers, data=json_data)
print(response.text)
url = "https://dt.bd.cn/main/quark_list"
headers = {
"Host": "dt.bd.cn",
"Connection": "keep-alive",
"Content-Length": "15",
"Accept": "*/*",
"X-Requested-With": "XMLHttpRequest",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 NetType/WIFI MicroMessenger/7.0.20.1781(0x6700143B) WindowsWechat(0x6309092b) XWEB/9105 Flue",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Origin": "https://dt.bd.cn",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://dt.bd.cn/main/quark_list",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9"}
body = f'bs={tgm}'
response = requests.post(url=url, data=body, headers=headers)
#print(response.text)
try:
aaa = json.loads(response.text)
if aaa['msg'] == 'ok' :
print(f'获取成功')
i = 0
html_code = "<table>\n<tr>\n<th>日期</th>\n<th>手机拉新 </th>\n<th>PC拉新 </th>\n<th>转存数 </th>\n<th>会员分成 </th>\n</tr>\n"
for list in aaa['data']['list']:
#print(list['date_str'],list['mobile_count'],list['pc_count'],list['store_count'],list['mobile_fencheng'])
html_code += "<tr>\n"
html_code += f"<td style='border: 1px solid black;'>{list['date_str']} </td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['mobile_count']}</td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['pc_count']}</td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['store_count']}</td>\n"
html_code += f"<td style='border: 1px solid black;'>{list['mobile_fencheng']}</td>\n"
html_code += "</tr>\n"
i = i + 1
if i >30 :# 取30条 {"code":999,"msg":"发送内容过大,不能超过2万字","data":null}
break
html_code += "</table>"
#print(html_code)
push_content=html_code
wxpusher_send()
else:
print(f'获取失败')
except Exception:
print(response.text)
都看到这了,我插个广告:推文第二条是好评100%的推广工具~
- End -
更多精彩文章
点击下方名片关注【偶尔敲代码】