
** 想必在座的各位lsp都已经等不及了。 废话不多说,直接上源码!**
**这里方便大家复制,直接粘贴源码上来!**注释源码的主要部分。
简单易懂。容易上手
import requests
from lxml import etree
str_html = requests.get("https://www.zxsbb.com/165.html")
html = etree.HTML(str_html.text)
img_url_list = html.xpath('//div[@class="single-text"]//p//img/@src')
print(img_url_list)
i = 1
for img_url in img_url_list:
img = requests.get(img_url)
dir = "D://images/"+str(i)+".jpg"
i += 1
fp = open(dir, "wb")
fp.write(img.content)
fp.close()
img_url_list那段代码稍微说一下 
在小姐姐照片的界面右键鼠标,点击检查,再点一下黄色箭头位置的,点击你想看的照片,查看照片的具体位置。 用xpath爬取照片的地址
//div[@class=“single-text”]//p//img/@src 定义到[div class=“single-text”]的位置,再逐步往下,定位到img,找到你所需要的照片地址
看看效果图(涉嫌违规= =! 只能这么做了)
 
第一张是我发现了其他小姐姐,又继续改了代码继续爬的。 第二张是上面代码的结果图。

这个是我爬小姐姐的网站。偶然间发现的,代码可通用,换成其他网站的话需要调改一下! 网址https://www.zxsbb.com/ 希望各位lsp能喜欢(滑稽。) 
博主还是大三在读学生。大数据专业,爱好小姐姐。写的不好还请多见谅。 有什么问题可评论我们相互讨论!!! 点赞关注打赏都可以来一手,我劝你别不识抬举 
|