用户工具

站点工具


web:crawler.mzitu
urls=[]
url='https://www.mzitu.com/'
urls.push(url)
lastPage=parseInt($("div.nav-links a.next").prev().text())
for(page=2;page<=lastPage;page++){
urls.push(url+'page/'+page+'/')
}
data={}
data['info']={lastPage:lastPage}
crawl = {'urls':urls,data:data}
urls=[]
data={}
$('img.lazy').each(function(idx,img){
urls.push($(this).attr('src'))
data['img-'+idx]={
alt:$(this).attr('alt'),
src:$(this).attr('src')
}
})
crawl = {'urls':urls,data:data}
urls=[]
url=$("div.pagenavi a:first-child").attr('href')
urls.push(url)
lastPage=parseInt($("div.pagenavi a:last-child").prev('a').text())
for(page=2;page<=lastPage;page++){
urls.push(url+'/'+page)
}
data={}
data['info']={lastPage:lastPage}
crawl = {'urls':urls,data:data}
urls=[]
url=$("div.main-image img").attr('src')
urls.push(url)
crawl = {'urls':urls}
web/crawler.mzitu.txt · 最后更改: 2019/07/09 23:13 由 admin