Python in the multi play picture to download the implementation of the girl picture code
# -*- coding:utf-8 -*-import httplibimport urllibimport stringimport redef getContent(): # Get all the content from the website conn = httplib.HTTPConnection("tu.duowan.com") conn.request("GET", "/m/meinv/index.html") r = conn.getresponse() print r.status, r.reason data1 = r.read()#.decode('utf-8') # The code is handled according to the actual situation return data1def getImageUrl(data): # To get to the img Links to sour.txt File China sour = open("test\sour.txt", 'w') pplen = len("http://s1.dwstatic.com/group1/M00/37/2A/e2c30e89184ea942a4be9c1f7ba217a5.jpg") for i in range(len(data) - 3): if data[i] == 'i' and data[i + 1] == 'm' and data[i + 2] == 'g': for j in xrange(i + 9, i + 9 + pplen): sour.write(data[j]) sour.write('n') sour.close()def downImage(): # According to the test\sour.txt The inside of the url Automatically download pictures tt = 0 #name sour = open('test\sour.txt') while 1: line = sour.readline() if line: Len = len(line) #print Len if line[Len - 2] == 'g' and line[Len - 3] == 'p' and line[Len - 4] == 'j': path = line data = urllib.urlopen(line).read() f = open('test\' + str(tt) + '.jpg', 'wb') f.write(data) f.close() tt = tt + 1 else: break sour.close()content = getContent()getImageUrl(content)downImage()