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'])
Python360翻译
最新推荐文章于 2024-10-31 23:38:32 发布