В голове есть идея написать программу, которая будет скачивать видео с сайта и отправлять через телеграм бота. Файл скачиваю через библиотеку requests, он имеет расширение ".ts", но с отправкой проблема
Код:
receive=open('file.ts', 'r')
bot.send_video('id', receive)
receive.close()
Ошибка:
Traceback (most recent call last):
File "1.py", line 9, in <module>
bot.send_video('id', receive)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\__init__.py", line 733, in send_video
apihelper.send_video(self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup,
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 397, in send_video
return _make_request(token, method_url, params=payload, files=files, method='post')
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\apihelper.py", line 57, in _make_request
result = _get_req_session().request(method, request_url, params=params, files=files,
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 516, in request
prep = self.prepare_request(req)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 449, in prepare_request
p.prepare(
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 317, in prepare
self.prepare_body(data, files, json)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 505, in prepare_body
(body, content_type) = self._encode_files(files, data)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 159, in _encode_files
fdata = fp.read()
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 959: character maps to <undefined>
С файлами расширения ".mp4" та же беда.