当前位置:网站首页>Netease cloud sign in lottery? That year I could sign in for 365 days. No? Look.
Netease cloud sign in lottery? That year I could sign in for 365 days. No? Look.
2022-06-30 23:09:00 【Climb all over the world】
Preface
Hello everyone , Here is a data acquisition , Whether in life or at work , For us programmers , Headphones can be said to be an essential tool , Bring it to work , Put it outside when driving , I also wear it on the bus and subway . So what kind of music software do you usually use ? Then I'll come first . I only use Netease cloud , The others are basically unused . use QQ Music can be reviewed 1, Netease cloud button 2, Cool dog button 3. Should basically use these three . Welcome to comment on your music software , There are surprises in the comments .

One of the reasons why I use Netease cloud is that there are some touching comments under the song . So I like . Well, there's a lot of nonsense , Now let's get to the main topic
Text
In fact, many websites have sign in lottery , Or sign in and send gifts , Today is also idle and boring , The boss can't find me fishing . So let's give you a small case . Today's case is the Netease cloud auto sign in script , You deserve it .
Since we need to sign in , First , Naturally, you need to simulate login , Here we are still simply using our open source DecryptLogin Library to achieve Netease cloud music simulation login :
''' Simulated Login '''@staticmethoddef login(username, password):lg = login.Login()_, session = lg.music163(username, password)return session
After successful login , Let's analyze how to realize the automatic check-in of Netease cloud music . Press F12 Open developer tools , Then click the sign in button of Netease cloud music :

Then I'm grade nine , Is there anything higher than me ? I don't think so .
We'll find a suspected sign in post request :

Its link is composed of :
'https://music.163.com/weapi/point/dailyTask?csrf_token=' + csrfIn previous articles, we said ,csrf This parameter is used after login cookies You can find , Like this :
csrf = re.findall('__csrf=(.*?) for', str(session.cookies))[0]So the problem we need to solve now is how to find the post The request needs to be submitted data Original text , Because what you see on the web page is encrypted , Just like this. :

I don't know why I intuitively want to search first daily Keyword ( Because it is still a direct analysis js Code break point ,

The first is obviously that we found the check-in interface , Then click the second one to have a look :

query It can't be the original we want . try ? If you try to succeed, it's not blood ? therefore , Call DecryptLogin Netease cloud music written in Library post Parameter encryption algorithm , Let's encrypt it data( Netease cloud music all post Requested and carried data The original text should be encrypted with an encryption algorithm before submission ):
from DecryptLogin.platforms.music163 import Crackercracker = Cracker()
# notes : typeid by 0 representative APP Sign in , by 1 The representative signs in on the website
data = {
'type': typeid
}
data = cracker.get(data)Then send a request to test it :
signin_url = 'https://music.163.com/weapi/point/dailyTask?csrf_token=' + csrf
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
'Content-Type': 'application/x-www-form-urlencoded',
'Referer': 'http://music.163.com/discover',
'Accept': '*/*'
}
res = self.session.post(signin_url, headers=headers, data=data)It is found that the returned data is like this :

This result shows that our conjecture is completely correct , Just because we've checked in , That's why duplicate check-in is displayed . Last , In order to save the time of entering the account password on the command line every day , We can add a few lines of code to the front of the script :
if os.path.exists('config.json'):
f = open('config.json', 'r', encoding='utf-8')
info = json.load(f)
f.close()
else:
args = parseArgs()
info = {'username': args.username, 'password': args.password}
f = open('config.json', 'w', encoding='utf-8')
json.dump(info, f)
f.close()Explain what the code means , That is, if there is... In the current folder config.json This file :

So let's go straight from this json Read the user's account name and password in the file , Otherwise, start the command line parameter parsing function :
''' Command line parameter parsing '''
def parseArgs():
parser = argparse.ArgumentParser(description=' Netease cloud music automatically signs in ')
parser.add_argument('--username', dest='username', help=' user name ', type=str, required=True)
parser.add_argument('--password', dest='password', help=' password ', type=str, required=True)
args = parser.parse_args()
return argsLet the user enter the account password manually , And automatically save to config.json In this file , So you don't have to re-enter your account password next time .
All done~ Follow the official account below for the complete source code
Effect display
Operation mode :
python signin.py --username user name --password password Because it involves the account password , Just code it . Just cut an effect picture , Because I signed in once during the test , Therefore, running the script to check in again will show that the check-in failed because of repeated check-in , Too lazy to find a new account

Let me see which brother can be higher than me .
边栏推荐
- CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
- Redis的事务和锁机制
- Online customer service chat system source code_ Beautiful and powerful golang kernel development_ Binary operation fool installation_ Attached construction tutorial
- latex左侧大括号 latex中大括号多行公式
- Neo4j load CSV configuration and use
- 电商秒杀系统
- Redis - 01 cache: how to use read cache to improve system performance?
- Detailed explanation of conv2d of pytorch
- [Android, kotlin, tflite] mobile device integration depth learning light model tflite (image classification)
- MaxPool2d详解--在数组和图像中的应用
猜你喜欢

一次革命、两股力量、三大环节:《工业能效提升行动计划》背后的“减碳”路线图

MIT博士论文 | 优化理论与机器学习实践

One revolution, two forces and three links: the "carbon reduction" road map behind the industrial energy efficiency improvement action plan

“飞桨+辨影相机”成为AI界的“预制菜”,工业AI质检落地更简单

Online customer service system code_ H5 customer service_ Docking with official account_ Support app_ Support for multiple languages

Redis' transaction and locking mechanism

深入解析 Apache BookKeeper 系列:第四篇—背压

Introduction to digital transformation solutions for enterprises going to sea

In depth analysis of Apache bookkeeper series: Part 4 - back pressure

Online customer service chat system source code_ Beautiful and powerful golang kernel development_ Binary operation fool installation_ Attached construction tutorial
随机推荐
Redis的事务和锁机制
MIT doctoral dissertation optimization theory and machine learning practice
HP 惠普笔记本电脑 禁用触摸板 在插入鼠标后
Where can I find the computer version of wechat files
公有云市场迈入深水区,冷静的亚马逊云还坐得住吗?
Redis - 01 cache: how to use read cache to improve system performance?
QQmlApplicationEngine failed to load component qrc:/main. qml:-1 No such file or directory
How does win11 optimize services? Win11 method of optimizing service
E-commerce seckill system
项目管理到底管的是什么?
10 airbags are equipped as standard, and Chery arizer 8 has no dead corner for safety protection
The superficial understanding of the industrial Internet finally brought the development of the industrial Internet into the strange circle of the consumer Internet
What does project management really manage?
RIDE:获取图片base64
Ctfshow permission maintenance
Solution to the conflict between unique index and logical deletion
In depth analysis of Apache bookkeeper series: Part 4 - back pressure
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
Doker's container data volume
2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main() { ints := make