国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python3簡單實現微信爬蟲

2020-02-23 00:38:24
字體:
來源:轉載
供稿:網友

使用ghost.py 通過搜搜 的微信搜索來爬取微信公共賬號的信息

# -*- coding: utf-8 -*-import sysreload(sys)import datetimeimport timesys.setdefaultencoding("utf-8") from ghost import Ghostghost = 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 BeautifulSoupc=0while 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能夠有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 东乌| 时尚| 大渡口区| 江阴市| 大石桥市| 凉城县| 贡嘎县| 海兴县| 乡城县| 长葛市| 大冶市| 阳江市| 宣恩县| 潢川县| 娱乐| 柳州市| 金山区| 古蔺县| 辽中县| 库伦旗| 会宁县| 荆州市| 海南省| 镇赉县| 蚌埠市| 东至县| 黄梅县| 顺义区| 乐亭县| 柳河县| 康马县| 赣榆县| 昭通市| 广饶县| 安新县| 浦城县| 信丰县| 信宜市| 汕尾市| 正定县| 渝北区|