import urllib.request
import http.client
import re
from urllib import request,parse
def getTInfo(key):
# 通过抓包的方式获取的url,并不是浏览器上显示的url
url = "http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule&smartresult=ugc&sessionFrom=null"
# 完整的headers
headers = {
"Accept" : "application/json, text/javascript, */*; q=0.01",
"X-Requested-With" : "XMLHttpRequest",
# 这里可以导入上次写的User-Agent池
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0",
"Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8",
}
formdata = {
"i":key,
"from":"auto",
"to":&