国产探花免费观看_亚洲丰满少妇自慰呻吟_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能夠有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 固安县| 卓资县| 灵山县| 昌乐县| 天津市| 缙云县| 军事| 临湘市| 林口县| 平陆县| 大化| 文成县| 新巴尔虎右旗| 博兴县| 大悟县| 芜湖市| 商南县| 桂阳县| 顺平县| 屯昌县| 望奎县| 六枝特区| 平泉县| 石柱| 黑山县| 龙川县| 峨边| 宁强县| 怀来县| 永胜县| 大关县| 郁南县| 龙海市| 仪征市| 将乐县| 澄城县| 长岛县| 崇阳县| 南乐县| 永善县| 罗山县|