Spaces:
Running
Running
Update turbowarp-server/qr-converter.py
Browse files
turbowarp-server/qr-converter.py
CHANGED
|
@@ -24,8 +24,8 @@ last_n1 = None
|
|
| 24 |
|
| 25 |
while True:
|
| 26 |
try:
|
| 27 |
-
|
| 28 |
-
n1 = str(
|
| 29 |
|
| 30 |
if n1 != last_n1:
|
| 31 |
last_n1 = n1
|
|
@@ -45,10 +45,19 @@ while True:
|
|
| 45 |
# 既読にする
|
| 46 |
tw.set_variable(name="n1", value="0" + "1" + recv_id)
|
| 47 |
|
|
|
|
| 48 |
url = f"https://20.rf.gd/set.php?project_id={recv_id}"
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
print("short_id:", short_id)
|
| 54 |
|
|
|
|
| 24 |
|
| 25 |
while True:
|
| 26 |
try:
|
| 27 |
+
n1_raw = tw.get_variable(name="n1")
|
| 28 |
+
n1 = str(n1_raw).replace('☁ n1', '').strip() # '☁ n1' 対策
|
| 29 |
|
| 30 |
if n1 != last_n1:
|
| 31 |
last_n1 = n1
|
|
|
|
| 45 |
# 既読にする
|
| 46 |
tw.set_variable(name="n1", value="0" + "1" + recv_id)
|
| 47 |
|
| 48 |
+
# APIアクセス
|
| 49 |
url = f"https://20.rf.gd/set.php?project_id={recv_id}"
|
| 50 |
+
try:
|
| 51 |
+
res = requests.get(url, cookies={"__test": "872039d283902860e895efb6018d2632"}, timeout=5)
|
| 52 |
+
res.raise_for_status()
|
| 53 |
+
data = res.json()
|
| 54 |
+
short_id = data.get("short_id", "000")
|
| 55 |
+
except requests.exceptions.RequestException as e:
|
| 56 |
+
print("API接続エラー:", e)
|
| 57 |
+
short_id = "000"
|
| 58 |
+
except ValueError:
|
| 59 |
+
print("API JSON解析エラー")
|
| 60 |
+
short_id = "000"
|
| 61 |
|
| 62 |
print("short_id:", short_id)
|
| 63 |
|