作者wsybu (%小步步%)
看板Python
标题Re: [问题] 无法成功显示表特版图片连结
时间Wed Oct 16 16:04:17 2019
※ 引述《hosayhosay (猫猫)》之铭言:
: rs=requests.session()
: rs.post('https://webptt.com/cn.aspx?n=/ask/over18', verify=False,data=payload)
: url='https://webptt.com/cn.aspx?n=bbs/Beauty/index.html'
: res=rs.get(url,verify=False)
: print(res.text)
: soup=BeautifulSoup(res.text,'html.parser')
: articles= soup.select('div.title a')
: for art in articles:
: print(art)
: res = requests.get('https://webptt.com/cn.aspx?n=/bbs'+art['href'])
你前面18岁验证已经放在rs里面了, 所以你这边要改成rs.get
然後文章网址多了一个bbs路径
所以改成 res = rs.get('
https://webptt.com/cn.aspx?n='+art['href'], verify=False)
试看看
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.250.32.15 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1571213060.A.0CD.html
1F:推 hosayhosay: 谢谢w大大,但是它还是不行,错误显示 AttributeErro 10/17 13:38
2F:→ hosayhosay: r: module 'requests' has no attribute 'session' 10/17 13:38