任务:js逆向有道翻译的参数,实现简易版的翻译
https://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule
步骤:
1 分析网页,找到有道翻译的API
2 通过扣代码,补充js环境
3 通过js和python的交互,可以实现
import execjs
import requests
class Youdao():
def __init__(self,key):
self.headers ={
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Length": "255",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",