import requests import os # Define the bot token BOT_TOKEN = "7705389636:AAGDS2OylYGWrnPyg1a0wG640JkeftmGgBE" # Use the provided chat ID CHAT_ID = "992569643" def send_video_to_bot(video_path): try: url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendVideo" files = {'video': open(video_path, 'rb')} data = {'chat_id': CHAT_ID, 'caption': 'Here is your video'} response = requests.post(url, files=files, data=data) if response.status_code == 200: print("Video sent successfully!") else: print(f"Failed to send video. Status code: {response.status_code}") print(response.text) except Exception as e: print(f"Error: {e}") def sendTelmain(): try: # Assuming the videos are stored in './vids/' video_files = os.listdir('./vids/') if video_files: for video in video_files: video_path = './vids/' + video send_video_to_bot(video_path) else: print("No videos to send.") except Exception as err: print(err) exit(1) if __name__ == '__main__': sendTelmain()