-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload_vid_tele.py
More file actions
45 lines (33 loc) · 1.3 KB
/
upload_vid_tele.py
File metadata and controls
45 lines (33 loc) · 1.3 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import datetime
from telethon import TelegramClient, events
import test
import edit_video
download_path = "downloaded_video/"
upload_path = "video_tip_top/"
api_id = 25261509
api_hash = "a690894b4f2c3f5dfdbdaaaed8c12a29"
download_chat_id = -1002126759941
upload_chat_id = -1002006536487
client = TelegramClient('ha', api_id, api_hash)
newest_msg_id_source = 0
# -------------------------------------------------------------
async def UpLoadVid(client, gr):
count = 0
for vid_name in test.GetFileName():
# print(f"editing {vid_name}")
# edit_video.MovingText(vid_name)
try:
file_path = upload_path + str(vid_name)
# channel = await client.get_entity(gr_name)
print(f"uploading....: {vid_name}")
print(f"time start: {datetime.datetime.now()}")
await client.send_file(gr, file_path)
print("upload successfully")
count += 1
print(f'{count} video uploaded')
print(f"time end: {datetime.datetime.now()}")
except Exception as err:
print(f"Error: {err}")
test.WriteUploadVidErr(gr)
# --------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------