码迷,mamicode.com
首页 > 其他好文 > 详细

利用 selenium 抓取 淘宝信息

时间:2017-06-04 19:52:51      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:bdr   port   group   match   imp   strftime   win   tao   tle   

import lxml
from bs4 import BeautifulSoup
import time
from selenium import webdriver
import re
driver = webdriver.PhantomJS()
driver.set_window_size(1600,20000)
driver.get("https://item.taobao.com/item.htm?spm=2013.1.0.0.bLyAul&id=17676925595")
time.sleep(10)
date=driver.page_source
soup=BeautifulSoup(date,"lxml")
shu_liang=re.findall(r.*title="30天内已售出(\d.*?)件,str(soup.select(".tb-sell-counter")))
color=re.findall(r<li title="(.*)">颜色分类|li title="(.*)">主要颜色,str(soup.select(".attributes-list")))
mig="http://"+ re.match(r.*?(//.*?alicdn.*?)_50x50.jpg,str(soup.select("#J_UlThumb > li > div > a > img"))).group(1)
daytime=time.strftime(%Y/%m/%d, time.localtime(time.time()))
leimu=soup.select(".tb-pine")[0].get("data-catid")
dates=[mig,shu_liang,color,daytime,leimu]
title=""
driver.save_screenshot(title.join(re.findall("([\u4e00-\u9fa5])",driver.title))+".jpg")
print(dates)
driver.quit()

 

利用 selenium 抓取 淘宝信息

标签:bdr   port   group   match   imp   strftime   win   tao   tle   

原文地址:http://www.cnblogs.com/gao-xiang/p/6941213.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!