Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
|
|
|
|
|
| 1 |
import requests
|
| 2 |
|
|
|
|
| 3 |
BOT_TOKEN = "8436389955:AAF7AnKrsU4EGgXgOAr_04-w22gIBPBGO40"
|
| 4 |
-
CHANNEL_ID = "-1003647736821"
|
| 5 |
-
VIDEO_FILE = "blurred_output.mp4" # the output from your blur API
|
| 6 |
-
|
| 7 |
-
def send_to_telegram(video_path):
|
| 8 |
-
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendDocument"
|
| 9 |
-
with open(video_path, "rb") as f:
|
| 10 |
-
files = {"document": f}
|
| 11 |
-
data = {"chat_id": CHANNEL_ID, "caption": "Test upload from HF Space"}
|
| 12 |
-
resp = requests.post(url, data=data, files=files)
|
| 13 |
-
return resp.json()
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
import requests
|
| 4 |
|
| 5 |
+
url = "https://files.catbox.moe/fpcqj3.mp4"
|
| 6 |
BOT_TOKEN = "8436389955:AAF7AnKrsU4EGgXgOAr_04-w22gIBPBGO40"
|
| 7 |
+
CHANNEL_ID = "-1003647736821"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
r = requests.get(url, stream=True)
|
| 10 |
+
files = {"document": ("blurred_output.mp4", r.raw)}
|
| 11 |
+
data = {"chat_id": CHANNEL_ID}
|
| 12 |
+
resp = requests.post(f"https://api.telegram.org/bot{BOT_TOKEN}/sendDocument", data=data, files=files)
|
| 13 |
+
print(resp.json())
|