python - 如何检查谷歌会议是否开放/是否可以加入(Python)
问题描述
我想制作一个 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()
响应中推断出会议状态,但似乎不可能。
推荐阅读
- r - 我无法在 dplyr 中计算均值和标准差
- javascript - Javascript对变量的不安全引用
- jenkins - 黄瓜 HTML 报告
- jwk - 我如何获得正确的苹果登录公钥
- java - 如何更改使用的 Java 版本的 SoapUI?
- python - 具有分组依据的 Django SQL Windows 函数
- mysql - laravel sql问题与查询where和or,丢失条件
- linux - 在 docker 容器中启用命令行审计日志记录 - kubernetes
- ocaml - 为什么会发生这种情况(Ocaml)
- typescript - 卡在反应原生 redash 库中