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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 呼图壁县| 留坝县| 石渠县| 天峻县| 宜都市| 永康市| 日照市| 博野县| 鄢陵县| 尼木县| 科技| 沙湾县| 涿州市| 长武县| 定结县| 华阴市| 依安县| 石林| 邛崃市| 长丰县| 库尔勒市| 庆城县| 海盐县| 天水市| 洛川县| 揭阳市| 平原县| 广南县| 内丘县| 石城县| 泉州市| 贞丰县| 政和县| 烟台市| 鄂温| 宁晋县| 大渡口区| 怀集县| 偏关县| 罗山县| 陇川县|