• 简书网微信公众号二维码
您当前的位置: 首页 > 知识百科 > python爬取微信朋友圈怎么实现?

python爬取微信朋友圈怎么实现?

时间:2023-07-01 14:05 阅读数:83 人阅读 分类:知识百科

  python爬取微信朋友圈怎么实现?python怎么爬取微信朋友圈?以下是小编整理的python爬取微信朋友圈的内容,以下的内容供您参考,希望对您有帮助。

  使用ghost.py 通过搜搜 的微信搜索来爬取微信公共账号的信息

  # -*- coding: utf-8 -*-import sysreload(sys)import datetimeimport timesys.setdefaultencoding("utf-8")

  from ghost import Ghostghost = Ghost(wait_timeout=20)

  url="weixin.sogou/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")

  简单讲几点:

  一、写入csv文件编码问题

  在上一篇文章中以及解释了。

  二、登录出现问题

  没有找到系统,在120行左右:

  6if sys.platform.find('darwin') >= 0: # 'darwin'

  subprocess.call(['open', QRImagePath])

  elif sys.platform.find('linux') >= 0:

  subprocess.call(['xdg-open', QRImagePath])

  else:

  os.startfile(QRImagePath)

  最后的else分句不可少。

  以上是小编整理的python爬取微信朋友圈的内容,希望以上内容能帮助到您,如果您还想了解更多精彩的微信素材,就请多多关注微素达网哦。更多精彩内容等着您。

相关推荐:

吐槽微信朋友圈广告的说说

微信广告主该如何投放朋友圈的广告?广告主收费标准是怎样?

微信朋友圈广告投放费用怎么算?