For Classic

mail@pastecode.io avatar
unknown
python
12 days ago
842 B
2
Indexable
Never
import requests
import tkinter as tk
from tkinter import filedialog

# Replace with your webhook URL
WEBHOOK_URL = 'YOUR_WEBHOOK_URL'

# Create a function to send the video
def send_video(video_path):
    with open(video_path, 'rb') as f:
        payload = {
            'content': 'Here is a video!'
        }
        files = {
            'file': (video_path.split('/')[-1], f)
        }
        response = requests.post(WEBHOOK_URL, data=payload, files=files)
        print(response.status_code)

# Open a file explorer to select a video
def select_video():
    root = tk.Tk()
    root.withdraw()  # Hide the root window
    video_path = filedialog.askopenfilename(title='Select a video', filetypes=[('Video Files', '*.mp4;*.mov;*.avi;*.mkv')])
    if video_path:
        send_video(video_path)

select_video()
Leave a Comment