简单的JS逆向爬虫

# -*- coding: UTF-8 -*-
import requests
import execjs

url = "https://fanyi.baidu.com/v2transapi"
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0",
    "Cookie": "BAIDUID=F679FACFFFF6AD7D4C8173BA5C9087C4:FG=1; BIDUPSID=F679FACFFFF6AD7D4C8173BA5C9087C4; PSTM=1588584464; REALTIME_TRANS_SWITCH=1; FANYI_WORD_SWITCH=1; HISTORY_SWITCH=1; SOUND_SPD_SWITCH=1; SOUND_PREFER_SWITCH=1; H_PS_PSSID=; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; Hm_lvt_64ecd82404c51e03dc91cb9e8c025574=1588594020,1588748826; __yjsv5_shitong=1.0_7_12e5291bb6dac1c7a0f02fcab32b1d1a84e4_300_1588752954722_183.17.231.151_5e79a5a0; yjs_js_security_passport=504ad338440156ebc5d9ce17b80808b177e25ac2_1588752955_js; Hm_lpvt_64ecd82404c51e03dc91cb9e8c025574=1588753446"
}

data = {
    "from": "en",
    "to": "zh",
    "query": "",  # query 翻译的的内容
    "transtype": "translang",
    "simple_means_flag": "3",
    "sign": "",  # sign是执行js代码得

你可能感兴趣的:(爬虫干货)