Home > other >  Py beginner, help you a great god!
Py beginner, help you a great god!

Time:10-07

I want to climb a treasure all dress chiffon skirt image
# http://s.taobao.com/list? SPM=a217f. 8051907.312344.11.4 aca33080R6p5b & amp; Q=chiffon skirt & amp; The cat=16 & amp; Style=grid& Seller_type=taobao& Bcoffset=0 & amp; S=0

The import urllib. Request
The import re
Keywd="chiffon skirt"
Keyname=urllib. Request. Quote (keywd)
Headers=(" the user-agent ", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 ")
Opener=urllib. Request. Build_opener ()
Opener. Addheaders=[headers]
Urllib. Request. Install_opener (opener)
For I in range (1, 5) :
Url="http://s.taobao.com/list SPM=a217f 8051907.312344.11.4 aca33080R6p5b & amp; Q="+ keyname +" & amp; The cat=16 & amp; Style=grid& Seller_type=taobao& Bcoffset=0 & amp; S="+ STR (I) * 60-1
data=https://bbs.csdn.net/topics/urllib.request.urlopen (url). The read (). The decode (" utf-8 ", "ignore")
Pat='pic_url "://" (. *?) "'
Result=re.com from running (pat). The.findall (data)
For j in range (0, len (result) :
Thisresult=result [j]
Thisurl="http://" + thisresult
The file="F: 22/img//" + STR (I) + STR (j) + ". JPG "
Urllib. Request. Urlretrieve (thisurl, filename=file)


Run time also have no wrong, then step by step, trying to find in the second loop before I print (result) when found list is empty, but the feeling didn't write regular wrong, so please everyone a great god looking is what reason!

CodePudding user response:

Try a wave, can jump over it
  • Related