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

首頁 > 網站 > 建站經驗 > 正文

python3簡單實現微信爬蟲

2024-04-25 20:32:20
字體:
來源:轉載
供稿:網友

使用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能夠有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 吴旗县| 台中县| 吉安县| 汝州市| 高州市| 深州市| 朔州市| 沧州市| 清河县| 永兴县| 凌云县| 噶尔县| 达拉特旗| 百色市| 施甸县| 莫力| 凤山市| 双柏县| 昭平县| 铁岭县| 卓尼县| 温泉县| 饶平县| 新绛县| 新闻| 靖安县| 江川县| 信阳市| 双辽市| 漳浦县| 淅川县| 达州市| 蓝田县| 拜泉县| 连州市| 斗六市| 诏安县| 广丰县| 班戈县| 武强县| 延庆县|