好友
阅读权限10
听众
最后登录1970-1-1
|
小小宇6
发表于 2020-11-28 00:14
本帖最后由 小小宇6 于 2020-12-1 12:56 编辑
一 、emmm,这是看酷安有人需要这个脚本,便顺手写了这个脚本,本人已经稳定使用了三天,Cookie和csrfToken具体过期时间还没有测试
二、支持酷推和Server酱 大家只需要将 抓取的Cookie 、csrfToken放入代码19到24行对应的位置即可
[Python] 纯文本查看 复制代码
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/11/26 9:46
# @Author : 奈落
# @FileName: 网易蜗牛读书签到.py
# @Software: PyCharm
# @52_name : 小小宇6
import requests
import time
'''
前提需要抓包网易蜗牛读书获取 Cookie 和 CsrfToken
具体抓包教程 看说明哈
抓包视频教程:http://www.iqiyi.com/v_23mlkuaqd1o.html
'''
class NeteaseSnail(object):
def __init__(self):
# 必填csrfToken
self.csrfToken = '填写csrfToken'
# 必填cookie
self.cookie = '填写cookie'
# 填写酷推key(可空)
self.spkey = "填写酷推key"
# Server酱推送(可空)
self.sckey = '填写Server酱key'
def Snial_sign(self):
url = 'https://du.163.com/activity/201907/activityCenter/sign.json?csrfToken=' + self.csrfToken
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Redmi K20 Pro Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36 NeteaseSnailReader/1.9.14 NetType/WIFI (bnvsballmdpkyzpmzjpkodpinjpkzaljnjmxotm1zjc3mgm4nde2ctzlnzlmzmywzdc1zmywzje%3d;xiaomi) NEJSBridge/2.0.0',
'Cookie': self.cookie,
'Referer': 'https://du.163.com/fe/client/welfare-exchange/dist/index.html',
'Origin': 'https://du.163.com'
}
resp = requests.post(url=url, headers=headers).json()
msg = resp['msg']
now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 28800))
try:
msg_reward = resp['message']
content = '【网易蜗牛读书】 \n' + '内容: ' + msg + '\n 奖励: ' + msg_reward + '\n 时间: ' + now
print(content)
except KeyError:
msg_reward = ''
content = '【网易蜗牛读书】 \n ' + '内容: ' + msg + '\n 时间: ' + now
print(content)
finally:
return content
# Server酱推送
def Server(self, content):
if self.sckey == '':
return
server_url = "https://sc.ftqq.com/" + str(self.sckey) + ".send"
data = {
'text': "网易蜗牛读书签到完成,点击查看结果",
'desp': content
}
requests.post(server_url, data=data)
# 酷推推送
def CoolPush(self, content):
if self.spkey == '':
return
cp_url = 'https://push.xuthus.cc/send/' + str(self.spkey)
requests.post(cp_url, content.encode('utf-8'))
def main(self):
content = self.Snial_sign()
self.Server(content)
self.CoolPush(content)
# 云函数入口
def main_handler(event, context):
snail = NeteaseSnail()
snail.main()
# 本地函数入口
if __name__ == '__main__':
snail = NeteaseSnail()
snail.main()
|
免费评分
-
查看全部评分
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|