qq_慕沐2454123
是不是GET请求啊 有些查询用Get就能完成 大多数表单那种用的POST
小小程序员一枚
如题,已经回复。
一往无前001
如图所示
慕设计5094245
Yuliya_Dai
慕斯卡020414
Python2中有urllib.urlencode
慕斯3387234
已经是POST方式了,还是灰色
慕盖茨8175301
pycharm,eclipse插件pydev都可以,当然这些工具的前提是你需要下载Python
abc通配符123_
你用一个需要登录账户密码的网页测试,找到请求方式是post,也就是Request Method:POST, 最下面就有Form Data
慕虎2043758
你的网址错了,报错的意思404,没有找到网页,正确的是:https://en.wikipedia.org/wiki/Main_Page
慕虎2043758
一般用fiddler捕获请求,还没试过用它发送请求呢。发送请求可以用PostMan,SoapUI(推荐)等工具。
一个没有定语的名字
怎么解决的,我出错了resp =urlopen(req,data=postData.encode("utf-8"))
iamYvette
代码我电脑python3.6能运行成功
是不是没添加python的path?
Kunz
# -*- coding: UTF-8 -*-import requestsimport refrom bs4 import BeautifulSoup url="*www.8qizi.com*/"header={ "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding":"gzip, deflate", "Accept-Language":"zh-CN,zh;q=0.8", "Cache-Control":"max-age=0", "Connection":"keep-alive", "Content-Length":"65", "Content-Type":"application/x-www-form-urlencoded", "Host":"btkitty.bid", "Origin":"*www.8qizi.com*/", "Referer":"*www.8qizi.com*/", "Upgrade-Insecure-Requests":"1", "User-Agent":"Mozilla/5.0 (Windows NT 10.0.14393; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2950.5 Safari/537.36" }while True: word=input("输入搜索关键词:") data={ "keyword":word, "hidden":"true" } res=requests.post(url,data=data,headers=header) bs=BeautifulSoup(res.text,"lxml") itemInfo=bs.find_all("dd",class_="option") torrent={} for item in itemInfo: magnet=item.find_next("a",href=re.compile("magnet.*")).attrs["href"] name=item.find_previous("a",href=re.compile("*种子的网站*/.*\.html")).text size=item.find_next(text=re.compile("\u6587\u4ef6\u5927\u5c0f")).find_next("b").text time=item.find_next(text=re.compile("\u6536\u5f55\u65f6\u95f4")).find_next("b").text hot=item.find_next(text=re.compile("\u4eba\u6c14")).find_next("b").text torrent[name]=[name,time,size,hot,magnet] for item in torrent: print("名称:",torrent[item][0]) print("发布时间:",torrent[item][1]) print("大小:",torrent[item][2]) print("热度:",torrent[item][3]) print("磁力链接:",torrent[item][4],'\n')
看不见丶樱花散尽
Python开发简单爬虫
看这篇教程
phoenixor
到处问问。
还在拼
看这里 http://outofmemory.cn/code-snippet/37910/python-requests-request-http-post-payload-method
滴滴艾斯
自己解答一波,是因为漏掉一个逗号。。。
鬼脚飞
先按F12打开开发者工具,然后手动选择起始站点、时间,点击查询,这样开发者工具就能捕获到data信息。
然后这些data信息用来当爬虫post的数据。
qq_蓝胖子_12
你的源代码贴出来
wangrui1990
慕粉3798231
知乎:Python 爬虫如何获取 JS 生成的 URL 和网页内容?
https://www.zhihu.com/question/21471960
L瑜的博客: 使用python抓取js动态加载的网页
JoshuaShang
现在的网址应该是这个了:台灣高鐵-時刻表與票價查詢 (thsrc.com.tw)
布考斯基范
import urllib
urllib.parse.urlencode