current position:Home>Python advanced: [Baidu translation reverse] graphic and video teaching!!!

Python advanced: [Baidu translation reverse] graphic and video teaching!!!

2022-01-29 23:36:11 Skin shrimp

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

Code Pipi shrimp A simple and interesting boy with sand sculpture , Like most of my friends, I like listening to music 、 game , Of course, in addition to this, there is an interest in writing ,emm..., It's a long time , Let's work hard together

If you think it's good , The ball is a concern


Open Baidu translation

image-20211016225528578

Reverse analysis

Open control bar , Enter a word in the input box , You can see the corresponding request on the right , The request received the result of translation

image-20211016225749764

below , Let's study this request

First of all, introduce the eyes , You can see , The request is POST request , Then there must be a requester

image-20211016230143084

You can see that the following is the request body , Let's analyze it individually

image-20211016230347703

 ​
 #  From what language to what language 
 from: en
 to: zh
 ​
 #  Words to be translated 
 query: love
 transtype: realtime
 simple_means_flag: 3
 ​
 #  The key is the following two 
 sign: 198772.518981
 token: e8ee595fdb9a062d2d41124d778ebd79
 ​
 domain: common
 Copy code 

Change one to translate , Comparing the above and below, we can find ,token Value has not changed , however sign Changed the

Try a few more , Can be determined ,sign Follow the translation and make changes ,token Fixed

image-20211016230807056


analysis sign

Search for v2transapi, Because this request will be initiated every time to obtain the translation results , So we search this keyword

image-20211016231130970

image-20211016231242618

Breaking point , Refresh request to see

You can see , Stopped here , It shows that our thinking is right

image-20211016231331047

You can see , The data of the request body comes from the above , So we're in sign Place a breakpoint , Go in and have a look sign How it was generated

image-20211016231435114

It can be seen through JS The final result of encryption and other operations , But there is a key value involved , That's it window[l], We won't look at that , To analyze token

image-20211016231640099


analysis token

so ,token It's through window.common.token Acquired , How do we know what this is

image-20211016231842543

Don't worry , If you don't make up your mind, search

image-20211016231947171

You can know ,token It turned out that it was generated when visiting the page , No wonder it's fixed

image-20211016232027068

Search the page for token, You can also find the following window.gtk

image-20211016232130646

Little buddy, do you remember there was a window[l], I'll compare the picture directly , After reading the picture below, I understand everything

image-20211016232145783


Train of thought

  1. First , We need to get token Values and gtk, These are the values to be used later
  2. Generate sign, Can copy JS, utilize python Library manipulation js, Pass parameter generation sign
  3. The beginning of the simulation POST request , Get translation results
  4. end

Video teaching

Life is so nourishing ? Hard core works :【 Baidu translation JS reverse 】, Nanny class course , You deserve it !_ Bili, Bili _bilibili

Do not change your name , Don't change your family name , All over the network Code Pipi shrimp , I think it's good , The ball has a one button three in a row , ha-ha

image.png


Last

I am a Code Pipi shrimp , A lover of sharing knowledge Shrimp lovers , In the future, we will continue to update blog posts that are beneficial to you , We look forward to your attention !!!

It's not easy to create , If this blog post is helpful to you , I hope you guys can connect three times with one button !, Thank you for your support , See you next time ~~~


 One key, three links .png

copyright notice
author[Skin shrimp],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/01/202201292336101727.html

Random recommended