展开全部
首先你需要了解如何用python进行爬虫,然后需要了解正则或者找寻条件的方法,给你62616964757a686964616fe4b893e5b19e31333337383839举个例子:
#coding:utf-8
import requests
from bs4 import BeautifulSoup
import re
DownPath = "D:/meinvtupian/"
import urllib
head = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'}
TimeOut = 5
PhotoName = 124
c = '.jpeg'
PWD="D:/meinvtupian/"
site = "http://www.mm131.com/xiaohua/"
Page = requests.session().get(site,headers=head,timeout=TimeOut)
Coding = (Page.encoding)
Content = Page.content.decode(Coding).encode('utf-8')
ContentSoup = BeautifulSoup(Content)
jpg = ContentSoup.findAll('img')
for photo in jpg:
PhotoAdd = photo.get('src')
PhotoName +=1
Name = (str(PhotoName)+c)
r = requests.get(PhotoAdd,stream=True)
with open(PWD+Name, 'wb') as fd:
for chunk in r.iter_content():
fd.write(chunk)
print ("你已经下载了 %d 图片" %PhotoName)