Python360翻译

import json
import requests
nums=int(input("请输入翻译方式: (0、汉翻英 1、英翻汉) "))
tex=input('请输入要翻译的内容:')
url = "https://fanyi.so.com/index/search"
headers = {
    "pro": "fanyi",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
}
cookies = {
    "QiHooGUID": "274F66037DB4904E31908DD69A32371A.1668067228020",
    "__guid": "15484592.4282392102209570300.1668067229644.3728",
    "so_huid": "115bUp6JeLLMyuakLLx4JMr2HMAbBSQCkH7s0xYXjg4gQ%3D",
    "__huid": "115bUp6JeLLMyuakLLx4JMr2HMAbBSQCkH7s0xYXjg4gQ%3D",
    "Q_UDID": "8cdd5f9d-b13b-0dc3-afc4-d47e0010ec0f",
    "gtHuid": "1",
    "count": "5",
    "__gid": "76078227.839168754.1668682385573.1677849809587.67"
}
data = {
    "eng": nums,
    "validate": "",
    "ignore_trans": "0",
    "query": tex
}
resp = requests.post(url=url, headers=headers, cookies=cookies,data=data)
data_json=json.loads(resp.text)
print('翻译过来的内容是:',data_json['data']['fanyi'])
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值