Página 4 de 4

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 27 Feb 2019, 00:31
por jonas23
Hola.

Perdón por resucitar un tema muerto 8-)

Pase por todos los pasos indicados en el tutorial, pero el bot no arranca, solo da este error:

python ../baj_TG/bot.py
Traceback (most recent call last):
File "../baj_TG/bot.py", line 115, in <module>
bot.polling()
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 192, in polling
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 215, in __threaded_polling
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 73, in raise_exceptions
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 54, in run
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 122, in __retrieve_updates
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 92, in get_updates
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 144, in get_updates
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 37, in _make_request
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Ya tengo el token y el admin en el bot.py, aunque no me aclaro que tengo que poner en esta línea:
"bot = telebot.TeleBot(ID_ADMIN)" , por probar puse "token id" y "userid", aun así en cualquier caso, falla con el mismo error de arriba.

El bot estará instalado en un raspberry pi 2B con kernel 4.14.79-v7+, usando python2.7.

Gracias.

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 27 Feb 2019, 06:12
por yoshito
Ni idea macho.

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 22 Mar 2019, 11:49
por rsessa
jonas23 escribió: 27 Feb 2019, 00:31 Hola.

Perdón por resucitar un tema muerto 8-)

Pase por todos los pasos indicados en el tutorial, pero el bot no arranca, solo da este error:

python ../baj_TG/bot.py
Traceback (most recent call last):
File "../baj_TG/bot.py", line 115, in <module>
bot.polling()
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 192, in polling
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 215, in __threaded_polling
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 73, in raise_exceptions
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 54, in run
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 122, in __retrieve_updates
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 92, in get_updates
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 144, in get_updates
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 37, in _make_request
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Ya tengo el token y el admin en el bot.py, aunque no me aclaro que tengo que poner en esta línea:
"bot = telebot.TeleBot(ID_ADMIN)" , por probar puse "token id" y "userid", aun así en cualquier caso, falla con el mismo error de arriba.

El bot estará instalado en un raspberry pi 2B con kernel 4.14.79-v7+, usando python2.7.

Gracias.
Borra la carpeta pyTelegramBotAPI y vuelve a descargar esta

Código: Seleccionar todo

git clone https://github.com/eternnoir/pyTelegramBotAPI.git
Vuele a ejecutar estos pasos del tutorial

Código: Seleccionar todo

cd pyTelegramBotAPI
y

Código: Seleccionar todo

sudo python setup.py install
Inicia el bot

Código: Seleccionar todo

python bot.py
Y reinicia el chat del bot en telegram

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 29 Jul 2019, 14:18
por davidCM
Hola buenas. He seguido todos los pasos y se inicia el bot pero cuando le paso algún archivo de una serie o algo así me lanza un error. A ver si alguien me puede echar una mano, muchas gracias.
2019-07-29 14:06:26,935 (util.py:66 WorkerThread1) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]',)
Traceback (most recent call last):
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "bot.py", line 77, in step_descargar
info = bot.get_file(m.document.file_id)
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 484, in get_file
return types.File.de_json(apihelper.get_file(self.token, file_id))
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 98, in get_file
return _make_request(token, method_url, params={'file_id': file_id})
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 56, in _make_request
return _check_result(method_name, result)['result']
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 75, in _check_result
raise ApiException(msg, method_name, result)
ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]
"
2019-07-29 14:06:26,969 (__init__.py:419 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]"
Exception in thread WorkerThread2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_innerException in thread WorkerThread1 (most likely raised during interpreter shutdown):

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 02 Ago 2019, 10:51
por jumped
davidCM escribió: 29 Jul 2019, 14:18 Hola buenas. He seguido todos los pasos y se inicia el bot pero cuando le paso algún archivo de una serie o algo así me lanza un error. A ver si alguien me puede echar una mano, muchas gracias.
2019-07-29 14:06:26,935 (util.py:66 WorkerThread1) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]',)
Traceback (most recent call last):
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "bot.py", line 77, in step_descargar
info = bot.get_file(m.document.file_id)
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 484, in get_file
return types.File.de_json(apihelper.get_file(self.token, file_id))
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 98, in get_file
return _make_request(token, method_url, params={'file_id': file_id})
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 56, in _make_request
return _check_result(method_name, result)['result']
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 75, in _check_result
raise ApiException(msg, method_name, result)
ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]
"
2019-07-29 14:06:26,969 (__init__.py:419 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]"
Exception in thread WorkerThread2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_innerException in thread WorkerThread1 (most likely raised during interpreter shutdown):
Hola, a mi también me da el mismo error, creo que es por el tamaño del archivo. Si lees en el foro unos mensajes atrás veras que alguien comenta que el archivo no puede pasar de 20 megas, si te das cuenta pone en una parte del error que has publicado "Bad Request: file is too big".
He probado con un archivo de 6 mb y funciona perfectamente, lastima esta limitación, estaría bastante bien que funcionara con todos los archivos subidos a Telegram. Si no existe esta limitación y estoy equivocado que alguien informe, me interesa el tema.
En las descargas de links bajándome un enlace de 1.2 gb no me ha dado error y lo ha descargado, pero claro a mi me interesaba la otra opción ya que para los links uso jdownloader.
Un saludo.

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 02 Dic 2019, 00:02
por Keepeek
Hola, buenas noches, llevo ya unos dias peleandome con el bot, no consigo que arranque de ninguna forma, y siempre me sale el mismo error. Podria alguien echarme una mano??

019-12-01 22:59:19,767 (util.py:66 PollingThread) ERROR - TeleBot: "AttributeError occurred, args=("'NoneType' object has no attribute 'format'",)
Traceback (most recent call last):
File "/root/pyTelegramBotAPI/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "/root/pyTelegramBotAPI/telebot/__init__.py", line 278, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/root/pyTelegramBotAPI/telebot/__init__.py", line 248, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/root/pyTelegramBotAPI/telebot/apihelper.py", line 189, in get_updates
return _make_request(token, method_url, params=payload)
File "/root/pyTelegramBotAPI/telebot/apihelper.py", line 49, in _make_request
request_url = base_url.format(token, method_name)
AttributeError: 'NoneType' object has no attribute 'format'
"
Traceback (most recent call last):
File "ej.py", line 18, in <module>
bot.polling()
File "/root/pyTelegramBotAPI/telebot/__init__.py", line 391, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "/root/pyTelegramBotAPI/telebot/__init__.py", line 414, in __threaded_polling
polling_thread.raise_exceptions()
File "/root/pyTelegramBotAPI/telebot/util.py", line 79, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/root/pyTelegramBotAPI/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "/root/pyTelegramBotAPI/telebot/__init__.py", line 278, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/root/pyTelegramBotAPI/telebot/__init__.py", line 248, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/root/pyTelegramBotAPI/telebot/apihelper.py", line 189, in get_updates
return _make_request(token, method_url, params=payload)
File "/root/pyTelegramBotAPI/telebot/apihelper.py", line 49, in _make_request
request_url = base_url.format(token, method_name)
AttributeError: 'NoneType' object has no attribute 'format'

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 14 Ene 2020, 20:57
por compi
jumped escribió: 02 Ago 2019, 10:51
davidCM escribió: 29 Jul 2019, 14:18 Hola buenas. He seguido todos los pasos y se inicia el bot pero cuando le paso algún archivo de una serie o algo así me lanza un error. A ver si alguien me puede echar una mano, muchas gracias.
2019-07-29 14:06:26,935 (util.py:66 WorkerThread1) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]',)
Traceback (most recent call last):
File "build/bdist.linux-armv7l/egg/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "bot.py", line 77, in step_descargar
info = bot.get_file(m.document.file_id)
File "build/bdist.linux-armv7l/egg/telebot/__init__.py", line 484, in get_file
return types.File.de_json(apihelper.get_file(self.token, file_id))
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 98, in get_file
return _make_request(token, method_url, params={'file_id': file_id})
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 56, in _make_request
return _check_result(method_name, result)['result']
File "build/bdist.linux-armv7l/egg/telebot/apihelper.py", line 75, in _check_result
raise ApiException(msg, method_name, result)
ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]
"
2019-07-29 14:06:26,969 (__init__.py:419 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}]"
Exception in thread WorkerThread2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_innerException in thread WorkerThread1 (most likely raised during interpreter shutdown):
Hola, a mi también me da el mismo error, creo que es por el tamaño del archivo. Si lees en el foro unos mensajes atrás veras que alguien comenta que el archivo no puede pasar de 20 megas, si te das cuenta pone en una parte del error que has publicado "Bad Request: file is too big".
He probado con un archivo de 6 mb y funciona perfectamente, lastima esta limitación, estaría bastante bien que funcionara con todos los archivos subidos a Telegram. Si no existe esta limitación y estoy equivocado que alguien informe, me interesa el tema.
En las descargas de links bajándome un enlace de 1.2 gb no me ha dado error y lo ha descargado, pero claro a mi me interesaba la otra opción ya que para los links uso jdownloader.
Un saludo.
he visto en esta pa´gina que igual puede funcionar probando con otra api
http://hackaffeine.com/2016/07/19/teleg ... descargas/

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 14 Ene 2020, 20:58
por compi
buenas, alguien sabe si esto se podría hacer en libreelec.
un saludo

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 15 Ene 2020, 14:02
por jumped
compi escribió: 14 Ene 2020, 20:58 buenas, alguien sabe si esto se podría hacer en libreelec.
un saludo
Yo diría que no, librelec es un sistema cerrado, con osmc seguramente sí.

Re: Crea un Bot en Telegram para descargar archivos a tu Pi con solo poner Link o Archivo de Telegram

Publicado: 01 Jul 2020, 12:14
por LoSKi
La API de telegram cambio esto no funciona