bot.send_video(query.message.chat.id, data='BQADAgADjAMAAoE_-Erybi9R9xMKlBYE', reply_markup=keyboard, caption='Как работает соляная пещера Соль Плюс? Посмотрите в видео 👆')
but get an error:
2019-08-22 23:16:04,885 (util.py:65 WorkerThread1) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[b\'{"ok":false,"error_code":400,"description":"Bad Request: type of file mismatch"}\']',)
Traceback (most recent call last):
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "salt_bot.py", line 68, in send_article
bot.sendvideo(query.message.chat.id, data='BQADAgADjAMAAoE-Erybi9R9xMKlBYE', reply_markup=keyboard, caption='Как работает соляная пещера Соль Плюс? Посмотрите в видео 👆')
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/init.py", line 719, in send_video
parse_mode, supports_streaming, disable_notification, timeout))
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/apihelper.py", line 383, in send_video
return _make_request(token, method_url, params=payload, files=files, method='post')
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/apihelper.py", line 56, in _make_request
return _check_result(method_name, result)['result']
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/apihelper.py", line 75, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: type of file mismatch"}']
"
2019-08-22 23:16:04,886 (init.py:417 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: type of file mismatch"}']"
Trying to send with URL:
bot.send_video(query.message.chat.id, data='https://youtu.be/NndioZqJzww', reply_markup=keyboard)
doesn't work as well:
2019-08-22 23:31:30,946 (util.py:65 WorkerThread2) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[b\'{"ok":false,"error_code":400,"description":"Bad Request: failed to get HTTP URL content"}\']',)
Traceback (most recent call last):
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "salt_bot.py", line 68, in send_article
bot.send_video(query.message.chat.id, data='https://youtu.be/NndioZqJzww', reply_markup=keyboard)
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/init.py", line 719, in send_video
parse_mode, supports_streaming, disable_notification, timeout))
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/apihelper.py", line 383, in send_video
return _make_request(token, method_url, params=payload, files=files, method='post')
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/apihelper.py", line 56, in _make_request
return _check_result(method_name, result)['result']
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/apihelper.py", line 75, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: failed to get HTTP URL content"}']
"
2019-08-22 23:31:30,947 (init.py:417 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: failed to get HTTP URL content"}']"
What am I doing wrong?
P.S.: A couple of days ago with another bot token it worked! (then I used another _fileid of the video)
P.P.S.: Using video argument (as wrote in Bot API of Telegram) instead of data, I recieve:
2019-08-22 23:18:11,539 (util.py:65 WorkerThread2) ERROR - TeleBot: "TypeError occurred, args=("send_video() got an unexpected keyword argument 'video'",)
Traceback (most recent call last):
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/util.py", line 59, in run
task(*args, *kwargs)
File "salt_bot.py", line 68, in send_article
bot.sendvideo(query.message.chat.id, video='BQADAgADjAMAAoE-Erybi9R9xMKlBYE', reply_markup=keyboard, caption='Как работает соляная пещера Соль Плюс? Посмотрите в видео 👆')
TypeError: send_video() got an unexpected keyword argument 'video'
"
Traceback (most recent call last):
File "salt_bot.py", line 458, in
bot.polling(none_stop=True)
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/init.py", line 389, in polling
self.threaded_polling(none_stop, interval, timeout)
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/init.py", line 413, in threaded_polling
self.worker_pool.raise_exceptions()
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/util.py", line 108, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/six.py", line 693, in reraise
raise value
File "/home/prisekin48/.virtualenvs/env3.7/lib/python3.7/site-packages/telebot/util.py", line 59, in run
task(args, **kwargs)
File "salt_bot.py", line 68, in send_article
bot.sendvideo(query.message.chat.id, video='BQADAgADjAMAAoE-Erybi9R9xMKlBYE', reply_markup=keyboard, caption='Как работает соляная пещера Соль Плюс? Посмотрите в видео 👆')
TypeError: send_video() got an unexpected keyword argument 'video'
Please answer these questions before submitting your issue. Thanks!
First of all I send a video to my bot to get _fileid:
{'content_type': 'document', 'message_id': 525, 'from_user': {'id': 250482971, 'is_bot': False, 'first_name': 'Alexandr', 'username': 'aprisekin48', 'last_name': 'Prisekin', 'language_code': 'en'}, 'date': 1566504687, 'chat': {'type': 'private', 'last_name': 'Prisekin', 'first_name': 'Alexandr', 'username': 'aprisekin48', 'id': 250482971, 'title': None, 'all_members_are_administrators': None, 'photo': None, 'description': None, 'invite_link': None, 'pinned_message': None, 'sticker_set_name': None, 'can_set_sticker_set': None}, 'forward_from_chat': None, 'forward_from': None, 'forward_date': None, 'reply_to_message': None, 'edit_date': None, 'media_group_id': None, 'author_signature': None, 'text': None, 'entities': None, 'caption_entities': None, 'audio': None, 'document': {'file_id': 'BQADAgADjAMAAoE_-Erybi9R9xMKlBYE', 'thumb': None, 'file_name': 'video.mp4', 'mime_type': 'video/mp4', 'file_size': 12782120}, 'photo': None, 'sticker': None, 'video': None, 'video_note': None, 'voice': None, 'caption': None, 'contact': None, 'location': None, 'venue': None, 'new_chat_member': None, 'new_chat_members': None, 'left_chat_member': None, 'new_chat_title': None, 'new_chat_photo': None, 'delete_chat_photo': None, 'group_chat_created': None, 'supergroup_chat_created': None, 'channel_chat_created': None, 'migrate_to_chat_id': None, 'migrate_from_chat_id': None, 'pinned_message': None, 'invoice': None, 'successful_payment': None, 'connected_website': None, 'json': {'message_id': 525, 'from': {'id': 250482971, 'is_bot': False, 'first_name': 'Alexandr', 'last_name': 'Prisekin', 'username': 'aprisekin48', 'language_code': 'en'}, 'chat': {'id': 250482971, 'first_name': 'Alexandr', 'last_name': 'Prisekin', 'username': 'aprisekin48', 'type': 'private'}, 'date': 1566504687, 'document': {'file_name': 'video.mp4', 'mime_type': 'video/mp4', 'file_id': 'BQADAgADjAMAAoE_-Erybi9R9xMKlBYE', 'file_size': 12782120}}}
I take this: BQADAgADjAMAAoE_-Erybi9R9xMKlBYEThen I try to send video like this:
bot.send_video(query.message.chat.id, data='BQADAgADjAMAAoE_-Erybi9R9xMKlBYE', reply_markup=keyboard, caption='Как работает соляная пещера Соль Плюс? Посмотрите в видео 👆')
but get an error:Trying to send with URL:
bot.send_video(query.message.chat.id, data='https://youtu.be/NndioZqJzww', reply_markup=keyboard)
doesn't work as well:What am I doing wrong?
P.S.: A couple of days ago with another bot token it worked! (then I used another _fileid of the video) P.P.S.: Using video argument (as wrote in Bot API of Telegram) instead of data, I recieve: