首页 > 解决方案 > 如何检查谷歌会议是否开放/是否可以加入(Python)

问题描述

我想制作一个 python 程序,可以检查 google meet 是否打开/是否可以加入(比如从 cmd 执行 ping meet.google.com/custom-meeting-link)。有没有我可以使用的模块/任何方式来做到这一点?

标签: pythongoogle-meet

解决方案


如果 ping 方法有效,您可以使用它(即使不是在本机 python 中)

import subprocess

ret = subprocess.run(["ping", "https://meet.google.com/custom-meeting-link"])

然后检查ret

编辑:另一种方法是请求页面并解析它。保持简单,您只需检查页面标题(此处使用bs4):

import requests
from bs4 import BeautifulSoup

html = requests.get("meet.google.com/custom-meeting-link")
soup = BeautifulSoup(html.text, 'html.parser')
titlestring = soup.find('title').text

# If title string contains the title of the error page, there's no meeting, else it is online

我检查了是否可以仅从requests.get()响应中推断出会议状态,但似乎不可能。


推荐阅读