故梦L 发表于 2018-4-22 20:45:07

数据抓取

<div>import urllib.request
import urllib.parse

url='http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule'

data={}
data['action']='FY_BY_CLICKBUTTION'
data['client']='fanyideskweb'
data['doctype']='json'
data['from']='AUTO'
data['i']='who'
data['keyfrom']='fanyi.web'
data['salt']='1524400207311'
data['sign']='e3d748c43dc47fbbf010e3444eba76d7'
data['smartresult']='dict'
data['to']='AUTO'
data['typoResult']='false'
data['version']='2.1'

data=urllib.parse.urlencode(data).encode('utf-8')

req=urllib.request.Request(url,data)
response=urllib.request.urlopen(req)
html=response.read().decode('utf-8')
print(html)</div><div>
</div><div>
</div><div>为什么抓取返回“errorcode”???
</div>




ba21 发表于 2018-4-22 21:18:53

反爬了,换网站练习吧

新手·ing 发表于 2018-4-22 21:19:16

http://bbs.fishc.com/thread-105393-1-1.html

gopythoner 发表于 2018-4-23 09:07:58

最新爬虫 http://bbs.fishc.com/forum.php?mod=viewthread&tid=106892&highlight=%D3%D0%B5%C0%B7%AD%D2%EB
页: [1]
查看完整版本: 数据抓取