python爬虫selenium+firefox抓取京东商品评论
2018-01-18 18:28
1076 查看
from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary caps=webdriver.DesiredCapabilities().FIREFOX caps['marionette']=True binary=FirefoxBinary(r'D:\Program Files\Firefox\firefox.exe') driver=webdriver.Firefox(firefox_binary=binary,capabilities=caps) driver.get('https://item.jd.com/5725260.html?jd_pop=12a9a276-18c3\ -4502-b324-738b240534c4&abt=0#comment') ''' #单页评论 com=driver.find_elements_by_css_selector('p.comment-con') for each_com in com: coms=each_com.text print(coms) ''' #多页评论 import time for x in range(0,2): com=driver.find_elements_by_css_selector('p.comment-con') for each_com in com: coms=each_com.text print(coms) try: next_page=driver.find_element_by_class_name('ui-pager-next') next_page.click() time.sleep(5) except: break ''' com=driver.find_elements_by_css_selector('div.comment-item') for each_com in com: coms=each_com.text print(coms)#所有信息 ''' ''' com=driver.find_elements_by_css_selector('div.comment-item') for each_com in com: coms=each_com.find_elements_by_css_selector('div.order-info')[0] print(coms.text)#所有信息中某类信息 '''
相关文章推荐
- [置顶] [爬虫]使用python抓取京东全站数据(商品,店铺,分类,评论)
- Python+Selenium+Chrome抓取京东商品信息
- python制作爬虫爬取京东商品评论教程
- Python爬虫,抓取淘宝商品评论内容
- Python爬虫(一)京东商品价格及详情页抓取
- python爬虫(7)——获取京东商品评论信息
- 基于selenium和requests的京东商品信息和评论爬虫
- python制作爬虫爬取京东商品评论教程
- python爬虫selenium+firefox抓取动态网页--表情包爬虫实战
- 【Python】抓取京东列表页商品信息(selenium)
- [Python爬虫] Selenium爬取新浪微博客户端用户信息、热点话题及评论 (上)
- [Python爬虫] 之二十三:Selenium +phantomjs 利用 pyquery抓取智能电视网数据
- python3[爬虫实战] 使用selenium,xpath爬取京东手机(下)
- 网易新闻评论爬虫(python+selenium+PhantomJS)
- 简单的抓取淘宝关键字信息、图片的Python爬虫|Python3中级玩家:淘宝天猫商品搜索爬虫自动化工具(第二篇)
- Python爬虫使用Selenium+PhantomJS抓取Ajax和动态HTML内容
- 带你写爬虫(python)第二篇----抓取网易云音乐下面的评论(API方式)
- python3[爬虫实战] 使用selenium,xpath爬取京东手机(上)
- python利用urllib实现爬取京东网站商品图片的爬虫实例
- python json 爬京东商品评论