分析
爬取地址:https://www.58pic.com/piccate/10-0-0-p1.html

可以看出p1、p2代表页数

详情页在class="thumb-box"元素里

具体图片在class="show-area-pic"里
数据库创建
import pymysql
db = pymysql.connect('localhost','root','','_pro')
cursor = db.cursor()
cursor.execute('drop table if exists pageTable')
cursor.execute('''CREATE TABLE `pageTable` (
`num` int NOT NULL AUTO_INCREMENT ,
`title` varchar(255) NOT NULL ,
`md5` varchar(255) NOT NULL ,
PRIMARY KEY (`num`)
);
''')
db.close()
爬虫代码
import requests

本文介绍了如何使用Python爬虫从指定网址抓取图片,计算图片的MD5值,并将这些信息存储到MySQL数据库中。爬虫代码实现了对5页数据的抓取,并提供了数据库创建和结果截图。
最低0.47元/天 解锁文章
715





