|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import urllib.request as url
from urllib.parse import urlencode
import json as j
head = {}
head['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom'
data = {\
'client': "pc",\
'exchange':'false',\
'fr':"browser_pc",\
'from':"auto",\
'needQc':'1',\
's':"d78cdd5a1a76770c398ca51493d3a2c0",\
'text':"I like FishC.com",\
'to':"zh-CHS",\
'uuid':"12681881-4857-4a6a-be0e-8c7bd28a73d3"}
data = urlencode(data).encode('utf-8')
ps=url.ProxyBasicAuthHandler({'http':'223.244.179.85:3256'})
opener = url.build_opener(ps)
opener.addheaders = [head]
name = url.Request(r'https://fanyi.sogou.com/api/transpc/text/result',data,head)
response = opener.open(name)
html = response.read().decode('utf-8')
print(html)
不仅进不去还报错
本帖最后由 nahongyan1997 于 2021-8-11 17:15 编辑
给你看看我这打印出来的东西,我什么都没动 Python 3.8.8 (C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe)
>>> %Run 1.py
b'{"status":0,"info":"success","zly":"zly","node":"1","data":{"translate":{"zly":"zly","errorCode":"0","qc_type":"2","index":"content0","from":"en","source":"sogou","text":"I like FishC.com","to":"zh-CHS","id":"a5ffe05c-34dd-4467-8308-9cb786a9a93d","dit":"\xe6\x88\x91\xe5\x96\x9c\xe6\xac\xa2FishC.com","orig_text":"I like FishC.com","diff_text":"\xee\x90\x8aI like FishC.com\xee\x90\x8b\xee\x90\x8cilikefishc.com\xee\x90\x8d","qc_text":"ilikefishc.com","md5":""},"detect":{"zly":"zly","detect":"en","errorCode":"0","language":"\xe8\x8b\xb1\xe8\xaf\xad","id":"573c5190-fa84-11eb-913f-31d41187ce12","text":"I like FishC.com"},"sgtkn":"CB157737AF83C5C3B3B67D8E1C7E84C5B48B72CD611394A3","wordCard":{"title":false,"show":false,"usual_Dict":"","second_query":"","exchange":"","levelList":""},"detail":"","book":"","network":"","pic":"","voice":"","keywords":[{"key":"like","value":"\xe5\x83\x8f\xef\xbc\x9b\xe7\x9b\xb8\xe4\xbc\xbc\xef\xbc\x9b\xe7\xb1\xbb\xe4\xbc\xbc\xef\xbc\x9b\xe4\xbe\x8b\xe5\xa6\x82\xef\xbc\x9b\xe5\xa5\xbd\xe6\xaf\x94\xef\xbc\x9b\xe5\xa6\x82\xe5\x90\x8c\xef\xbc\x9b\xe7\xac\xa6\xe5\x90\x88\xe2\x80\xa6\xe7\x9a\x84\xe6\x96\xb9\xe5\xbc\x8f\xef\xbc\x9b\xe8\x83\xbd\xe6\x96\x99\xe6\x83\xb3\xe5\x88\xb0\xe7\x9a\x84\xef\xbc\x9b\xe6\x9c\x89\xe2\x80\xa6\xe7\x89\xb9\xe7\x82\xb9\xe7\x9a\x84\xef\xbc\x9b\xe5\x90\x8c\xe2\x80\xa6 \xe4\xb8\x80\xe6\xa0\xb7\xef\xbc\x9b\xe5\xa6\x82\xef\xbc\x9b\xe5\xa5\xbd\xe5\x83\x8f\xef\xbc\x9b\xe5\x90\x8c\xe6\xa0\xb7\xe7\x9a\x84\xe4\xba\xba\xef\xbc\x9b\xe5\x96\x9c\xe7\x88\xb1\xef\xbc\x9b\xe5\x90\x8c\xe6\xa0\xb7\xe7\x9a\x84\xe4\xba\x8b\xef\xbc\x9b\xe7\x9b\xb8\xe5\x90\x8c\xe7\x9a\x84\xef\xbc\x9b\xe5\x90\x8c\xe6\xa0\xb7\xe7\x9a\x84\xef\xbc\x9b\xe9\x80\xbc\xe7\x9c\x9f\xe7\x9a\x84\xef\xbc\x9b\xe5\x83\x8f\xe7\x9a\x84\xef\xbc\x9b\xe4\xbb\xa5\xe2\x80\xa6\xe7\x9a\x84\xe6\x96\xb9\xe5\xbc\x8f\xef\xbc\x9b\xe5\xa5\xbd\xe5\x83\x8f\xe5\x9c\xa8\xe8\xaf\xb4\xef\xbc\x9b\xe5\x96\x9c\xe6\xac\xa2\xef\xbc\x9b\xe5\xb8\x8c\xe6\x9c\x9b\xef\xbc\x9b\xe6\x83\xb3\xe8\xa6\x81\xef\xbc\x9b\xe8\xae\xa4\xe4\xb8\xba\xef\xbc\x9b\xe4\xb8\x8d\xe6\x83\x85\xe6\x84\xbf\xef\xbc\x9b\xe6\x83\x85\xe6\x84\xbf\xe8\xa6\x81\xef\xbc\x9b\xe5\xae\x81\xe8\xa6\x81\xef\xbc\x9b\xe6\x84\x9f\xe8\xa7\x89"}],"isAutoMatch":false,"kana":""}}'
b'{"status":0,"info":"success","zly":"zly","node":"1","data":{"translate":{"zly":"zly","errorCode":"0","qc_type":"2","index":"content0","from":"en","source":"sogou","text":"I like FishC.com","to":"zh-CHS","id":"a5ffe05c-34dd-4467-8308-9cb786a9a93d","dit":"\xe6\x88\x91\xe5\x96\x9c\xe6\xac\xa2FishC.com","orig_text":"I like FishC.com","diff_text":"\xee\x90\x8aI like FishC.com\xee\x90\x8b\xee\x90\x8cilikefishc.com\xee\x90\x8d","qc_text":"ilikefishc.com","md5":""},"detect":{"zly":"zly","detect":"en","errorCode":"0","language":"\xe8\x8b\xb1\xe8\xaf\xad","id":"573c5190-fa84-11eb-913f-31d41187ce12","text":"I like FishC.com"},"sgtkn":"CB157737AF83C5C3B3B67D8E1C7E84C5B48B72CD611394A3","wordCard":{"title":false,"show":false,"usual_Dict":"","second_query":"","exchange":"","levelList":""},"detail":"","book":"","network":"","pic":"","voice":"","keywords":[{"key":"like","value":"\xe5\x83\x8f\xef\xbc\x9b\xe7\x9b\xb8\xe4\xbc\xbc\xef\xbc\x9b\xe7\xb1\xbb\xe4\xbc\xbc\xef\xbc\x9b\xe4\xbe\x8b\xe5\xa6\x82\xef\xbc\x9b\xe5\xa5\xbd\xe6\xaf\x94\xef\xbc\x9b\xe5\xa6\x82\xe5\x90\x8c\xef\xbc\x9b\xe7\xac\xa6\xe5\x90\x88\xe2\x80\xa6\xe7\x9a\x84\xe6\x96\xb9\xe5\xbc\x8f\xef\xbc\x9b\xe8\x83\xbd\xe6\x96\x99\xe6\x83\xb3\xe5\x88\xb0\xe7\x9a\x84\xef\xbc\x9b\xe6\x9c\x89\xe2\x80\xa6\xe7\x89\xb9\xe7\x82\xb9\xe7\x9a\x84\xef\xbc\x9b\xe5\x90\x8c\xe2\x80\xa6 \xe4\xb8\x80\xe6\xa0\xb7\xef\xbc\x9b\xe5\xa6\x82\xef\xbc\x9b\xe5\xa5\xbd\xe5\x83\x8f\xef\xbc\x9b\xe5\x90\x8c\xe6\xa0\xb7\xe7\x9a\x84\xe4\xba\xba\xef\xbc\x9b\xe5\x96\x9c\xe7\x88\xb1\xef\xbc\x9b\xe5\x90\x8c\xe6\xa0\xb7\xe7\x9a\x84\xe4\xba\x8b\xef\xbc\x9b\xe7\x9b\xb8\xe5\x90\x8c\xe7\x9a\x84\xef\xbc\x9b\xe5\x90\x8c\xe6\xa0\xb7\xe7\x9a\x84\xef\xbc\x9b\xe9\x80\xbc\xe7\x9c\x9f\xe7\x9a\x84\xef\xbc\x9b\xe5\x83\x8f\xe7\x9a\x84\xef\xbc\x9b\xe4\xbb\xa5\xe2\x80\xa6\xe7\x9a\x84\xe6\x96\xb9\xe5\xbc\x8f\xef\xbc\x9b\xe5\xa5\xbd\xe5\x83\x8f\xe5\x9c\xa8\xe8\xaf\xb4\xef\xbc\x9b\xe5\x96\x9c\xe6\xac\xa2\xef\xbc\x9b\xe5\xb8\x8c\xe6\x9c\x9b\xef\xbc\x9b\xe6\x83\xb3\xe8\xa6\x81\xef\xbc\x9b\xe8\xae\xa4\xe4\xb8\xba\xef\xbc\x9b\xe4\xb8\x8d\xe6\x83\x85\xe6\x84\xbf\xef\xbc\x9b\xe6\x83\x85\xe6\x84\xbf\xe8\xa6\x81\xef\xbc\x9b\xe5\xae\x81\xe8\xa6\x81\xef\xbc\x9b\xe6\x84\x9f\xe8\xa7\x89"}],"isAutoMatch":false,"kana":""}}'
{'data': {'book': '',
'detail': '',
'detect': {'detect': 'en',
'errorCode': '0',
'id': '573c5190-fa84-11eb-913f-31d41187ce12',
'language': '英语',
'text': 'I like FishC.com',
'zly': 'zly'},
'isAutoMatch': False,
'kana': '',
'keywords': [{'key': 'like',
'value': '像;相似;类似;例如;好比;如同;符合…的方式;能料想到的;有…特点的;同… '
'一样;如;好像;同样的人;喜爱;同样的事;相同的;同样的;逼真的;像的;以…的方式;好像在说;喜欢;希望;想要;认为;不情愿;情愿要;宁要;感觉'}],
'network': '',
'pic': '',
'sgtkn': 'CB157737AF83C5C3B3B67D8E1C7E84C5B48B72CD611394A3',
'translate': {'diff_text': '\ue40aI like '
'FishC.com\ue40b\ue40cilikefishc.com\ue40d',
'dit': '我喜欢FishC.com',
'errorCode': '0',
'from': 'en',
'id': 'a5ffe05c-34dd-4467-8308-9cb786a9a93d',
'index': 'content0',
'md5': '',
'orig_text': 'I like FishC.com',
'qc_text': 'ilikefishc.com',
'qc_type': '2',
'source': 'sogou',
'text': 'I like FishC.com',
'to': 'zh-CHS',
'zly': 'zly'},
'voice': '',
'wordCard': {'exchange': '',
'levelList': '',
'second_query': '',
'show': False,
'title': False,
'usual_Dict': ''}},
'info': 'success',
'node': '1',
'status': 0,
'zly': 'zly'}
>>>
|
|