Answer the question
In order to leave comments, you need to log in
Send a large video (more than 50mb) to telegram via a client as a video, not as a file?
In this form, the file is sent
. In this form, you need
Code:
import telebot
from selenium import webdriver
from bs4 import BeautifulSoup
import re
from pytube import YouTube
import os
import requests
from telethon import TelegramClient, sync
from class_json import work_json
from telethon.tl.types import DocumentAttributeVideo
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
r = requests.get(URL, stream=True)
with open(file_name, 'wb') as f:
for chunk in r.iter_content(chunk_size=256):
f.write(chunk)
metadata = extractMetadata(createParser(file_name))
msg = client.send_file(to, open(file_name, 'rb'), caption=name + '\n' + tags, supports_streaming=True, attributes=(
DocumentAttributeVideo(
(0, metadata.get('duration').seconds)[metadata.has('duration')],
(0, metadata.get('width'))[metadata.has('width')],
(0, metadata.get('height'))[metadata.has('height')]
),))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question