python+selenium搜狗微信主页抓取
来源:互联网 发布:linux黑客帝国代码雨 编辑:程序博客网 时间:2024/05/22 07:57
# coding:utf-8from selenium import webdriverfrom selenium.webdriver.common.action_chains import *import timeurl = 'http://weixin.sogou.com/'for i in range(0, 22): browser = webdriver.PhantomJS() browser.get(url) browser.refresh() # 鼠标悬停‘更多’ implement = browser.find_element_by_xpath("//a[@id='more_anchor']") ActionChains(browser).move_to_element(implement).perform() time.sleep(2) # 点击标签 browser.find_element_by_xpath("//a[@id='pc_"+str(i)+"']").click() x = browser.find_element_by_xpath("//a[@id='pc_"+str(i)+"']") # print x.text # 点击‘加载更多内容’ browser.find_element_by_xpath("//a[@id='look-more']").click() time.sleep(2) browser.find_element_by_xpath("//a[@id='look-more']").click() time.sleep(2) for j in range(0, 40): title = browser.find_element_by_xpath("//a[@uigs='pc_"+str(i)+"_"+str(j)+"_title']") detail = browser.find_element_by_xpath("//a[@uigs='pc_"+str(i)+"_"+str(j)+"_title']/../..//p") s = x.text+' '+title.text+' '+detail.text print s
阅读全文
0 0
- python+selenium搜狗微信主页抓取
- Python+Selenium+Chrome抓取京东商品信息
- python+selenium+chrome登录人人网爬取公共主页内容
- 使用Python+selenium+BeautifulSoup抓取动态网页的关键信息
- Python爬虫用Selenium抓取js生成的文件(一)
- 【Python】抓取京东列表页商品信息(selenium)
- Python网页测试库selenium,动态网页抓取
- 【Python】模拟登陆并抓取拉勾网信息(selenium+phantomjs)
- python+selenium+PhantomJS抓取ajax动态网页数据
- Python使用Selenium + PhantomJS抓取动态网页:今日头条
- python3抓取Bing主页背景图片
- selenium抓取动态网页
- Python抓取网页动态数据——selenium webdriver的使用
- (python解析js)selenium结合phantomjs抓取js生成的页面
- Python爬虫使用Selenium+PhantomJS抓取Ajax和动态HTML内容
- python selenium,PhantomJS运用 抓取滚动条滚动加载的页面, js动作操作,模拟登陆
- Python利用selenium模拟浏览器抓取异步加载等难爬页面信息
- selenium动态抓取页面元素
- 10.12java
- 嵌入式linux内核启动过程简明描述
- EPOLL
- 一周小程序【资讯教程Demo】更新
- best-time-to-buy-and-sell-stock Java code
- python+selenium搜狗微信主页抓取
- AngularJS验证两次密码是否相同
- Httpclient 参数
- 第一次作业
- 解决异常报错org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible问题
- sql时间截取转换大全
- 笔记4——C 字符串处理函数
- OpenCV之Mat矩阵和数组的运算
- 电脑C盘空间不足,应该如何扩展磁盘空间?