-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserbot.py
More file actions
27 lines (19 loc) · 715 Bytes
/
userbot.py
File metadata and controls
27 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from telethon import TelegramClient
from config import BOT_TOKEN, API_ID,API_HASH,ADMIN_ID
from yt_dlp import YoutubeDL
client = TelegramClient("userbot",API_ID,API_HASH)
async def upload_movie(url):
ydl_opts= {
'format': 'best',
'outtmpl': '%(title)s.%(ext)s',
'merge_output_format': 'mp4',
'quiet': False,
'ignoreerrors': False,
'cookiefile': 'D:/cooding/test/ytcookie.txt',
'no_warnings': True,
}
with YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=True)
video_path = ydl.prepare_filename(info)
message = await client.send_file(ADMIN_ID,video_path,caption="movie uploaded!")
return message