Handle gviz response prefix

This commit is contained in:
liuji
2026-10-10 15:00:23 +08:00
parent c5c64b2f05
commit 4a206e881c
+2
View File
@@ -44,6 +44,8 @@ def read_gviz(sheet: str) -> list[list[str]]:
response = requests.get(url, timeout=30) response = requests.get(url, timeout=30)
response.raise_for_status() response.raise_for_status()
text = response.text.strip() text = response.text.strip()
if text.startswith("/*O_o*/"):
text = text[len("/*O_o*/") :].strip()
if text.endswith(";"): if text.endswith(";"):
text = text[:-1].rstrip() text = text[:-1].rstrip()
if not text.startswith(GVIZ_PREFIX) or not text.endswith(")"): if not text.startswith(GVIZ_PREFIX) or not text.endswith(")"):