python3简单实现微信爬虫,python3信爬虫
python3简单实现微信爬虫,python3信爬虫
使用ghost.py 通过搜搜 的微信搜索来爬取微信公共账号的信息
# -*- coding: utf-8 -*- import sys reload(sys) import datetime import time sys.setdefaultencoding("utf-8") from ghost import Ghost ghost = Ghost(wait_timeout=20) url="http://weixin.sogou.com/gzh?openid=oIWsFt8JDv7xubXz5E3U41T0eFbk" page,resources = ghost.open(url) result, resources = ghost.wait_for_selector("#wxmore a") from bs4 import BeautifulSoup c=0 while True: if c>=30: break soup = BeautifulSoup(ghost.content) for wx in soup.find_all("h4"): print wx page, resources = ghost.evaluate( """ var div1 = document.getElementById("wxbox"); div1.innerHTML = ''; """) ghost.click("#wxmore a") result, resources = ghost.wait_for_selector(".wx-rb3") c=c+1 pass
以上所述就是本文的全部内容了,希望对大家学习Python能够有所帮助
相关内容
- 详解Python中的循环语句的用法,详解python
- 详解Python中的正则表达式的用法,python正则表达式
- 详解Python中的正则表达式的用法,python正则表达式
- 详解Python中的正则表达式的用法,python正则表达式
- 详解Python中的正则表达式的用法,python正则表达式
- 在Python的Flask框架下使用sqlalchemy库的简单教程,flasks
- Python线程中对join方法的运用的教程,pythonjoin
- 对于Python的Django框架部署的一些建议,pythondjango框架
- Python使用scrapy采集数据时为每个请求随机分配user-agen
- python threading模块操作多线程介绍,pythonthreading
评论关闭