首页建站经验 python3简单实现微信爬虫

python3简单实现微信爬虫

使用ghost.py 通过搜搜 的微信搜索来爬取微信公共账号的信息‘# -*- coding: utf-8 -*-import sysreload(sys)import datetimeimport timesys.setdefaultencoding("utf-8")f…

使用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 p1 = document.getElementById("wxbox")

p1.innerHTML = '';

""")

ghost.click("#wxmore a")

result, resources = ghost.wait_for_selector(".wx-rb3")

c=c+1

pass

以上所述就是本文的全部内容了,希望对大家学习Python能够有所帮助

本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/jianzhan/jingyan/16154.html
上一篇ecshop foreach循环判断循环中的每行第1个元素值!
下一篇 ecshop邮件模板的一个bug
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部