Code Monkey home page Code Monkey logo

telegram-downloader-bot's Introduction

telegram-downloader-bot

A Telegram bot for file downloading automation

If you have got an Internet connected computer or a NAS and you want to automate file downloading from Telegram channels, this bot is for you. You can share photos, audios, or small files with it and the bot will download them as well.

IMPORTANT: Telegram set up a limit to the size a bot can download (20Mb currently). If you plan to download big files, a bot will not work. Take a look on my alternative project: https://github.com/alfem/telegram-download-daemon

Installation

Just create a new Telegram bot (https://core.telegram.org/bots), edit this script and fill in the fields:

  • TELEGRAM_BOT_TOKEN: the unique token that indentifies your bot
  • TELEGRAM_CHAT_ID: you user (or group) id in Telegram. If you do not know it, you can talk to @get_id_bot and send it a "/my_id" command
  • DOWNLOADS_FOLDER: Change the download directory is desired.

Thanks to @mitto98 contribution you can use enviroment variables instead of editing the python file.

Install the python bot library, from Gihub (https://github.com/python-telegram-bot/python-telegram-bot) or using pip ( https://pypi.python.org/pypi/python-telegram-bot/). There are many telegram modules around. Do not use another one with a similar name.

Also "request" module is needed. It is very popular and probably you have it installed already. If not, just use pip or your system package manager.

Usage

Run the script (or the Docker container) and talk to your new bot!

You can:

  • Copy a file or photo post from a channel and share it with your downloader bot
  • Say "?" to your bot to check how many downloads are waiting in its queue
  • Say "quit" to stop the bot

telegram-downloader-bot's People

Contributors

alfem avatar mitto98 avatar radjah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

telegram-downloader-bot's Issues

file too big issue

there is any way to increase file size limit?
or any way to put it to download the file into other download daemon like aria2?

Add multi-user support

Is there a way to specify more than one "TELEGRAM_CHAT_ID" so more than one telegram user can use it?

Create Github action to publish the docker

You can use GitHub Actions to auto publish the docker image to docker registry.

I can help you with that, but I have no "media server" (respbery PI or something), so it is currently a low priority for me.

No default language could be detect.

Hi,
When I deploy it to Heroku it had failed everytime. And saw me the messages, "No default language could be detected for this app." What should I do?

Error running

This is what I get:

python2 telegram-download-bot.py
Traceback (most recent call last):
File "telegram-download-bot.py", line 116, in
photo=photos[-1]
IndexError: list index out of range

the bot on Telegram say that all is OK but don't answer

Python 3 support

It looks like this project runs only on Python 2, which ends its support on Jan 2020.

Are there any plans of porting to Python 3?

file is too big error

Hi there!

I stumbled upon your bot and I loved because I like the one-file bot, and not those overcomplicated bots out there, nice job! ๐Ÿ‘

I'm facing, but and isse with large files. I would like to send to my NAS tvshows files from other telegram groups/channels, and it seems normal bots cannot download/upload files greater than 20MB.

As I can't download the file, I've deleted that file I wanted to download, but now the bot automatically crashes

./telegram-download-bot.py 
Traceback (most recent call last):
  File "./telegram-download-bot.py", line 106, in <module>
    tfile=bot.getFile(newfile.file_id)
  File "/usr/lib/python2.7/site-packages/telegram/bot.py", line 66, in decorator
    result = func(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/telegram/bot.py", line 1546, in get_file
    result = self._request.post(url, data, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/telegram/utils/request.py", line 327, in post
    **urlopen_kwargs)
  File "/usr/lib/python2.7/site-packages/telegram/utils/request.py", line 238, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: File is too big

So, have you considered to use user bots instead normal bots to avoid the size limitation? Besides, is there any way to delete the "download queue" to let the bot start again?

Thank you!

Option to download audio/music

Sorry to put this issues one by one instead of combining them all... Will it be too much trouble to make the bot download audio files too?

Cheers!

How to download photo

this script can download attach file only . please help guide to download send as photo.

telegram.error.BadRequest: File is too big

First, thanks for sharing this script.
I have a problem with this script. Whenever I try to download file with size ~300mb, it returns the following error:
telegram.error.BadRequest: File is too big.

I also have another question or request:
Can we also download files that we shared as "quick send" in telegram like mp4?

file size limit

hi
great job on that one
but why is there a size limit on the video size?
can you fix that?

[Question]RPCError

Hi! I'm getting this: Error: RPCError -503: Timedout (caused by GetFileRequest)
Not sure if this is a local problem caused by my connection or my server but it has been happening for a few days. Is there any way to further investigate ?

Thanks for your work on this marvelous bot

Datetime object has no attribute 'timezone'

As title say... everytime i try to start the but it says:

.local/lib/python2.7/site-packages/telegram/utils/helpers.py", line 165, in
def from_timestamp(unixtime, tzinfo=dtm.timezone.utc):

runtimeError: freeze_support

Hello, my friend.
I'm using your script to download my files from telegram.
I did ALL you said before running the script but it fails after 'Downloader ready!' message, because of this error:

Traceback (most recent call last):
File "", line 1, in
File "C:\Python37\Lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Python37\Lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "C:\Python37\Lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Python37\Lib\multiprocessing\spawn.py", line 277, in _fixup_main_from
_path
run_name="mp_main")
File "C:\Python37\Lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Python37\Lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Python37\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
", line 56, in
manager = Manager()
File "C:\Python37\Lib\multiprocessing\context.py", line 56, in Manager
m.start()
File "C:\Python37\Lib\multiprocessing\managers.py", line 543, in start
self._process.start()
File "C:\Python37\Lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Python37\Lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Python37\Lib\multiprocessing\popen_spawn_win32.py", line 46, in ini
t

prep_data = spawn.get_preparation_data(process_obj.name)
File "C:\Python37\Lib\multiprocessing\spawn.py", line 143, in get_preparation

data
_check_not_importing_main()
File "C:\Python37\Lib\multiprocessing\spawn.py", line 136, in _check_not_impor
ting_main
is not going to be frozen to produce an executable.''')
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

What should I do to solve this?
Should I use previous versions of these libraries? or some parts of this script is missing?
I'm using Windows 7 x64.
Thanks. A LOT.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.