current position:Home>Python implements JS encryption algorithm in thousands of music websites
Python implements JS encryption algorithm in thousands of music websites
2022-01-29 16:10:18 【White and white I】
Little knowledge , Great challenge ! This article is participating in “ A programmer must have a little knowledge ” Creative activities
This article also participates in 「 Digging force Star Program 」 , Win a creative gift bag , Challenge creation incentive fund
Web crawler
Web crawler , I don't know if you know ? Today, I'm writing to you for nothing to understand the... In thousands of music websites JS encryption algorithm , If anything is wrong , Please correct me .
You who want to learn reptiles with me , Then you must first master some basic knowledge about reptiles , To know what a reptile is ? Where does the data come from ? First understand some basic knowledge points before you can really learn reptiles . Basic knowledge problems can be found on the Internet , Hee hee
My understanding of the crawler's work is to simulate the process of getting Web information through the browser , Nothing more “ Send a request — Get the page — Parsing the page — Extract and store content ” From this process , The information we can get is , In the crawler work, you need to involve the knowledge related to the front-end page , Knowledge of network protocol , And knowledge of data storage . Therefore, according to this process, we need to further master more technologies .
Crawlers have many functions in the Internet world , such as : Data collection \ Grab microblog comments ( Machine learning public opinion monitoring )\ Grab the recruitment information from the recruitment website ( Data analysis 、 mining )\ Sina rolling news \ Baidu news website \ software test \ Automated testing of crawlers \ Insect division \12306 Grab tickets \ Voting on the website \ Network security \ SMS bombing \web Vulnerability scanning and other useful, fun and interesting purposes .
To enter the body
Climb to the target
Website : Thousands of music - The wind blows (taihe.com)
Tool use
development tool :pycharm development environment :python3.7, Windows10 Using third party libraries :requests,time, hashlib
Focus on learning content
sign Parameter encryption
url Request parameter splicing
The use of timestamps
Page analysis
First, go to the music playing page Find the playback address
First step : Open the web page , Right click to check , Then click play music The second step : Select media interface The third step : To locate the interface when playing music , Because there is a separate interface when playing music
See the following figure for details :
Note that copying this suffix Used to search Look at the interface where the playback address contains
then ctrl+f Enter the keyword for the search
sign The generation location is return Put a breakpoint in front , See the following pictures
Note the encryption location md5 encryption algorithm , then r It's a request parameter , therefore seret The fixed string declared above .
Code implementation
import hashlib
import time
import requests
time1 = int(time.time())
r = f"TSID=T10046047408&appid=16073360×tamp={time1}" + '0b50b02fd0d73a9c4c8c3a781c30845f'
byte_row = r.encode('utf-8', 'ignore')
md5 = hashlib.md5()
md5.update(byte_row)
sign = md5.hexdigest()
url = f'https://music.taihe.com/v1/song/tracklink?sign={sign}&appid=16073360&TSID=T10046047408×tamp={time1}'
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38'
}
response = requests.get(url, headers=headers).json()
print(response)
Copy code
I am white and white i, A program Yuan who likes to share knowledge ️
Interested can pay attention to my official account : White and white Python【 Thank you very much for your praise 、 Collection 、 Focus on 、 Comment on , One key three links support 】
copyright notice
author[White and white I],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/01/202201291610176215.html
The sidebar is recommended
- [Python introduction project] use Python to generate QR code
- Compile D + +, and use d to call C from python
- Quickly build Django blog based on function calculation
- Python collects and monitors system data -- psutil
- Finally, this Python import guide has been sorted out. Look!
- Quickly build Django blog based on function calculation
- Python interface test unittest usage details
- Implementation of top-level design pattern in Python
- You can easily get started with Excel. Python data analysis package pandas (VII): breakdown
- Python simulation random coin toss (non optimized version)
guess what you like
-
Python tiktok 5000+ V, and found that everyone love this video.
-
Using linear systems in python with scipy.linalg
-
Using linear systems in python with scipy.linalg
-
Together with Python to do a license plate automatic recognition system, fun and practical!
-
You can easily get started with Excel. Python data analysis package pandas (XI): segment matching
-
Advanced practical case: Javascript confusion of Python anti crawling
-
Using linear systems in python with scipy.linalg
-
Fast power modulus Python implementation of large numbers
-
Quickly build Django blog based on function calculation
-
This paper clarifies the chaotic switching operation and elegant derivation of Python
Random recommended
- You can easily get started with Excel pandas (I): filtering function
- You can easily get started with Excel. Python data analysis package pandas (II): advanced filtering (I)
- You can easily get started with Excel. Python data analysis package pandas (2): advanced filtering (2)
- You can easily get started with Excel. Python data analysis package pandas (3): making score bar
- Test Development: self study Dubbo + Python experience summary and sharing
- You can easily get started with Excel. Python data analysis package pandas (V): duplicate value processing
- How does Python correctly call jar package encryption to get the encrypted value?
- Python 3 interview question: give an array. If there is 0 in the array, add a 0 after 0, and the overall array length remains the same
- Python simple Snake game (single player mode)
- Using linear systems in python with scipy.linalg
- Python executes functions and even code through strings! Come and understand the operation of such a top!
- Decoding the verification code of Taobao slider with Python + selenium, the road of information security
- [Python introduction project] use Python to generate QR code
- Vanessa basks in her photos and gets caught up in the golden python. There are highlights in the accompanying text. She can't forget Kobe after all
- [windows] Python installation pyteseract
- [introduction to Python project] create bar chart animation in Python
- Fundamentals of Python I
- Python series tutorials 116
- Python code reading (chapter 35): fully (deeply) expand nested lists
- Practical series 1 ️⃣ Wechat applet automatic testing practice (with Python source code)
- Python Basics: do you know how to use lists?
- Solution of no Python 3.9 installation was detected when uninstalling Python
- [Python homework] coupling network information dissemination
- [common links of Python & Python]
- Python application software development tool - tkinterdesigner v1.0 5.1 release!
- [Python development tool tkinterdiesigner]: example: develop stock monitoring alarm using Tkinter desinger
- [Python development tool Tkinter designer]: Lecture 2: introduction to Tkinter designer's example project
- [Python development tool Tkinter designer]: Lecture 1: introduction to the basic functions of Tkinter Designer
- [introduction to Python tutorial] use Python 3 to teach you how to extract any HTML main content
- Python socket implements UDP server and client
- Python socket implements TCP server and client
- leetcode 1261. Find Elements in a Contaminated Binary Tree(python)
- [algorithm learning] 1486 Array XOR operation (Java / C / C + + / Python / go / trust)
- leetcode 1974. Minimum Time to Type Word Using Special Typewriter(python)
- The mobile phone uses Python to operate picture files
- [learning notes] Python exception handling try except...
- Two methods of using pandas to read poorly structured excel. You're welcome to take them away
- Python sum (): the summation method of Python
- Practical experience sharing: use pyo3 to build your Python module
- Using Python to realize multitasking process