当前位置:网站首页>云函数实现网站自动化签到配置详解【Web函数/Nodejs/cookie】
云函数实现网站自动化签到配置详解【Web函数/Nodejs/cookie】
2022-07-28 23:15:00 【InfoQ】
一.前言


二.配置脚本过程
2.1获取某网站的cookie

2.2获取uuid、aid和_signature


2.3 脚本函数

module.exports = {
cookie: '',
PUSH_PLUS_TOKEN: '',
aid: '',
uuid: '',
_signature: ''
}
2.4 注册plus

2.5 配置config.js

三.部署脚本过程





四,脚本代码分享
const got = require('got')
const { cookie, aid, uuid, _signature, PUSH_PLUS_TOKEN } = require('./config')
const BASEURL = 'https:XXXX'
const PUSH_URL = 'http:XXXXX' // 推送api
const URL = `${BASEURL}?aid=${aid}&uuid=${uuid}&_signature=${_signature}`
const DRAW_URL = `https:xxxxx`
const HEADERS = {
cookie,
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.67'
}
// 签到
async function signIn () {
const res = await got.post(URL, {
hooks: {
beforeRequest: [
options => {
Object.assign(options.headers, HEADERS)
}
]
}
})
console.log(res.body)
draw()
if (!PUSH_PLUS_TOKEN) return
handlePush(res.body)
}
async function draw () {
const res = await got.post(DRAW_URL, {
hooks: {
beforeRequest: [
options => {
Object.assign(options.headers, HEADERS)
}
]
}
})
console.log(res.body)
}
// push
async function handlePush (desp) {
const body = {
token: `${PUSH_PLUS_TOKEN}`,
title: `签到结果`,
content: `${desp}`
};
const res = await got.post(PUSH_URL, {
json: body
})
console.log(res.body)
}
signIn()
边栏推荐
- COPU陆首群教授应邀在开放原子全球开源峰会上做主旨演讲
- I don't recommend you use Select*
- 2022dasctfjuly empowerment competition (reappearance)
- PTA (daily question) 7-70 diamond
- Dynamic programming problem (VII)
- 刷题的第三十天
- 15.模型评估和选择问题
- 会议OA项目之会议通知&会议反馈&反馈详情功能
- Talk about seven ways to realize asynchronous programming
- (20211130更新)关于jupyter notebook的下载安装及自己的配置、主题
猜你喜欢

Shell programming specifications and variables

"Food alliance ordering system"

NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作

DRF - paging, JWT introduction and principle, JWT quick use, JWT source code analysis, JWT custom return format, custom user issued token, custom token authentication class

What are the skills of API interface optimization?

“吃货联盟定餐系统”

AQS原理

Requestvideoframecallback() simple instance

Talk about seven ways to realize asynchronous programming

Application and principle of distributed current limiting redistribution rratelimiter
随机推荐
Anomaly detection and unsupervised learning (2)
JWT token related configuration (global configuration identity authentication rewrites authenticate method)
The download file of native JS implementation can be used anywhere
最长上升子序列
110 MySQL interview questions and answers (continuously updated)
Api 接口优化有哪些技巧?
armeabi-v7a架构(sv7a)
Isolation level of MySQL, possible problems (dirty reading, unrepeatable reading, phantom reading) and their solutions
Some operations of Ubuntu remote server configuration database (unable to locate package MySQL server, steps of installing mysql, unable to enter password when logging in MySQL)
[development tutorial 11] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - explanation of the function code of the whole machine
Still writing a lot of if to judge? A rule executor kills all if judgments in the project
Shell programming specifications and variables
Brief introduction to compressed sensing
SDRAM控制器设计(数字控制器的两种设计方法)
AQS原理
华为发布HarmonyOS 3.0,向“万物互联”再迈一步
【开发教程11】疯壳·开源蓝牙心率防水运动手环-整机功能代码讲解
PTA (daily question) 7-73 turning triangle
Introduction and solution of common security vulnerabilities in Web System SQL injection
Techo Hub 福州站干货来袭|与开发者共话工业智能新技术