crack

  • Access to the url
  • The way data is sent
  • Structural data
  • To get the results

Access to the url

You can use Chrome’s developer tool Network to view detailed data about how the request occurred, retrieve header data, and send data

Data sending mode

Generally, you can choose either GET or POST. You can view detailed data information and obtain the request in POST mode

Structural data

Make multiple requests, figure out what each field means, and then construct each field. It’s basically four fields that are changing. Salt: I = “” + ((new Date).getTime() + parseInt(10 * math.random (), 10)) sign: # o = n.md5(“fanyideskweb” + “word” + salt + “ebSeFb%=XZ%T[KZ)c(sy!”);

Ts: indicates the complete timestamp string. Bv: indicates the MD5 of the client version. This value will not change if the client is changed

To get the results

Use python3’s Requests library to get the sent result and print it out.

subsequent

If the number of requests after youdao official back to block IP, if the IP block, the need to use IP proxy and multiple request headers to achieve a complete code to achieve a tool.


# -*- coding: utf-8 -*-


import requests
import random
import time
import hashlib

word = "Rain tonight."
appversion = "5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"

data = {
        "i": word,
        "from": "AUTO"."to": "AUTO"."smartresult": "dict"."client": "fanyideskweb"."doctype": "json"."version": "2.1"."keyfrom": "fanyi.web"."action": "FY_BY_REALTlME"
}

salt = str(int(time.time() * 1000) + random.randint(0.9))
sign = hashlib.md5()
sign.update("".join([
        "fanyideskweb", word, salt, "@6f#X3=cCuncYssPsuRUE"
]).encode("utf-8"))
sign = sign.hexdigest()

bv = hashlib.md5()
bv.update("".join([appversion]).encode("utf-8"))
bv=bv.hexdigest()

data["salt"] = salt
data["sign"] = sign
data["ts"] = str(int(time.time() * 1000))
data["bv"] = bv


headers = {
        "Accept": "application/json, text/javascript, */*; Q = 0.01"."Accept-Encoding": "gzip, deflate"."Accept-Language": "zh-CN,zh; Q = 0.9, en - US; Q = 0.8, en. Q = 0.7"."Connection": "keep-alive"."Content-Length": "251"."Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"."Cookie": "OUTFOX_SEARCH_USER_ID = - 399226185 - @10.108.160.19; JSESSIONID=aaaI_UrHnAfSw6oMdoRTw; OUTFOX_SEARCH_USER_ID_NCOO = 670443238.5496794; ___rl__test__cookies=1560871983956"."Host": "fanyi.youdao.com"."Origin": "http://fanyi.youdao.com"."Referer": "http://fanyi.youdao.com/"."User-Agent": "Mozilla / 5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"."X-Requested-With": "XMLHttpRequest"
}

url = "http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule"
response = requests.post(url, data=data, headers=headers)
print(response.text)

Copy the code