#!/usr/bin/python
#-*-coding:utf-8-*-
import sys
import urllib
reload(sys)
sys.setdefaultencoding("utf-8")
mmurl = "http://mm.taobao.com/json/request_top_list.htm?type=0&page="
temp = "<img src="
i = 0
while i < 4 :
url = mmurl + str(i)
up = urllib.urlopen(url)
out = up.read()
cat_out = out.decode('gbk')
h = "<img src="
e = ".jpg"
ph = cat_out.find(h)
#找到每个模特的个人中心
ahref = "<a href="
af = "target"
head = cat_out.find(ahref)
foot = cat_out.find(af)
self_url = cat_out[head + len(ahref) +1 : foot-2]
modelurl = urllib.urlopen(self_url)
mcont = modelurl.read()
mcont = mcont.decode('gbk')
#爬取模特的图片
imgh = "<img style"
imge = ".jpg"
iph = mcont.find(imgh)
ipe = mcont.find(imge,iph)
imgurl = mcont[iph : ipe + len(imge)]
#-*-coding:utf-8-*-
import sys
import urllib
reload(sys)
sys.setdefaultencoding("utf-8")
mmurl = "http://mm.taobao.com/json/request_top_list.htm?type=0&page="
temp = "<img src="
i = 0
while i < 4 :
url = mmurl + str(i)
up = urllib.urlopen(url)
out = up.read()
cat_out = out.decode('gbk')
h = "<img src="
e = ".jpg"
ph = cat_out.find(h)
pe = cat_out.find(e)
# i += 1
#print cat_out[ph + len(temp) + 1: pe + len(e)]#找到每个模特的个人中心
ahref = "<a href="
af = "target"
head = cat_out.find(ahref)
foot = cat_out.find(af)
self_url = cat_out[head + len(ahref) +1 : foot-2]
modelurl = urllib.urlopen(self_url)
mcont = modelurl.read()
mcont = mcont.decode('gbk')
# i + = 1
# print mcont
#爬取模特的图片
imgh = "<img style"
imge = ".jpg"
iph = mcont.find(imgh)
ipe = mcont.find(imge,iph)
imgurl = mcont[iph : ipe + len(imge)]
ips = imgurl.find("src")
print imgurl[ips + 5 :]
i += 1