|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 风尘岁月 于 2020-5-30 05:41 编辑
斗图网网址:https://www.doutula.com/photo/list/
因为没权限发图片 所以我直接把字给弄下来了
表情包蜘蛛.py
1
import requests
2
import parser
3
4
base_ urL = ' https :/ /www。doutula。com/photo/list/'
headers = {'Users -Agent': 'Mozilla/5.0 (Windows. NT 6.1: WOW64) AppLeWebKit/537 .36 (KHTML, like Gecko) Chrome/70.0.....
8
nesponse = requests.get(urL = base_ urL, headers. = headers)
print (response)
0
11
Run:表情包蜘蛛
D: \python . exe C:/Users/ Administrator/Desktop/开发工具/python/ python成果/爬取表情包/表情包蜘蛛. py
<Response [404]>
Process finished with exit code 0
我后面的请求头没有全部截取
本帖最后由 suchocolate 于 2020-5-30 13:57 编辑
看上去你贴的网站没什么问题,我用这个代码可以滤出图片URL
- import requests
- from lxml import etree
- url = 'https://www.doutula.com/photo/list/'
- headers = {'user-agent': 'firefox'}
- r = requests.get(url, headers=headers)
- html = etree.HTML(r.text)
- result = html.xpath('//img/@data-original')
- print(result)
复制代码
|
|