问题描述
我想制作一个 python 程序,它可以检查 google meet 是否开放/可以加入(比如从 cmd 执行 ping meet.google.com/custom-meeting-link)。 有没有我可以使用的模块/有什么方法可以做到这一点?
解决方法
如果 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()
响应中推断会议状态,但似乎不可能。
我以前从未使用过 Google Meet,但您可能可以检测到 Google Meet 是否使用其 API 开放