Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk download images #1382

Open
amiremami opened this issue Dec 12, 2015 · 51 comments
Open

Bulk download images #1382

amiremami opened this issue Dec 12, 2015 · 51 comments

Comments

@amiremami
Copy link

@amiremami amiremami commented Dec 12, 2015

For example my friend upload and send me 10 pictures to me. Please provide an option to download all of them together, not one by one.

@auchri auchri changed the title [Feature Request][Desktop] Bulk Download Images Bulk Download Images Dec 13, 2015
@auchri auchri changed the title Bulk Download Images Bulk download Images Dec 13, 2015
@auchri auchri changed the title Bulk download Images Bulk download images Dec 13, 2015
@auchri auchri added this to the Next version milestone Dec 29, 2015
@auchri auchri removed this from the Next version milestone Jan 4, 2016
@amiremami
Copy link
Author

@amiremami amiremami commented Mar 4, 2016

@auchri is it possible to add this feature? Takes so much time to download one by one.

@Aokromes
Copy link
Collaborator

@Aokromes Aokromes commented Apr 20, 2016

#809 ?

@auchri
Copy link
Contributor

@auchri auchri commented Apr 20, 2016

@Aokromes it's related to #809, but it's not the same.

@amiremami
Copy link
Author

@amiremami amiremami commented Jun 22, 2016

My sister sent me 100 photos from the trip we went and I wasn't able to download the images one by one! So she emailed me. Here is a real situation when telegram lacks this feature.

@MasterGroosha
Copy link

@MasterGroosha MasterGroosha commented Mar 2, 2017

@amiremami I know this is a dumb workaround, but:

  1. Set "Default download path" to the folder you want your photos to be downloaded.
  2. Open the most recent photo in a batch.
  3. Hover mouse over "Download" icon.
  4. Now repedeately press "Left" (or "Right", I don't remember) on keyboard and click left mouse button.

This is the fastest (IMO) method (~2 photos per second) to bulk download images.
Or setup an IFTTT integration...

@amiremami
Copy link
Author

@amiremami amiremami commented Mar 2, 2017

Hey @MasterGroosha thanks a lot for this trick. Yeah it works, or we can use gmail for sending images, much more easier!

Hope Telegram adds this feature 😞

@Speeddymon
Copy link

@Speeddymon Speeddymon commented Jul 3, 2017

Upvote from me. Android has an option to auto save all images to gallery, but that feature is missing on Windows (PC) version. Would like to be able to auto save all images on PC so that I can avoid filling up my sd card, as I have a 36 terabyte NAS server which I can save images to instead.

@ghost
Copy link

@ghost ghost commented Sep 12, 2017

I thought it already was possible, was surprised it was not.
Ideally, what I would like to do is to select a few pictures/messages and right click > save image as...
Saving to the default download folder is limited to the current image being viewed, and for a Telegram Desktop folder with a lot of files it is really inconvenient to have to look and find the ones I want right now.

@telegramdesktop telegramdesktop deleted a comment from danger89 Oct 1, 2017
@Julian1984
Copy link

@Julian1984 Julian1984 commented Feb 1, 2018

Just an up to this enhancement. It's necessary to get this option to download or resend images.

@Zebradil
Copy link

@Zebradil Zebradil commented Feb 3, 2018

Quick tip. It is possible to download media with small python script.

  1. Goto https://my.telegram.org and generate api id and api hash
  2. Install Telethon library with pip3 install telethon
  3. Run following code (replace api_id, api_hash and username with your values):
from telethon.sync import TelegramClient
api_id=123456
api_hash='secretHashYO'
client = TelegramClient('test_session', api_id, api_hash)
client.start()
for message in client.iter_messages('username', limit=25):
    client.download_media(message)

This code downloads media from the last 25 messages from the dialog with username user in current directory.

UPD: Made the script work with the new version of the library (as of 2019-08-08).
UPD 2019-11-14: Replaced get_message_historyiter_messages as the former doesn't work anymore.

@moham96
Copy link

@moham96 moham96 commented Feb 22, 2018

This would be extremely useful not for images only but also for files

@ganesh-deshmukh
Copy link

@ganesh-deshmukh ganesh-deshmukh commented Jul 11, 2018

@Zebradil , nice trick to download, but can it download all videos of the specific group?

@Zebradil
Copy link

@Zebradil Zebradil commented Jul 11, 2018

@ganeshdeshmukh1612, At the moment I used this approach there was no way to request only media files. If Telegram API is not changed, you have to iterate over all messages in a channel and process each of them one by one.

@drakmail
Copy link

@drakmail drakmail commented Oct 6, 2018

@ganeshdeshmukh1612 I used this script to download all media from specific group:

requirements.txt

beautifulsoup4==4.6.0
certifi==2017.11.5
chardet==3.0.4
click==6.7
Django==1.11.9
dparse==0.4.1
idna==2.6
mercurial==4.4.2
packaging==17.1
protobuf==3.5.1
pycairo==1.17.0
pygobject==3.28.2
pyparsing==2.2.0
pytz==2017.3
PyYAML==3.13
requests==2.18.4
safety==1.8.4
six==1.11.0
sshuttle==0.78.3
urllib3==1.22
virtualenv==15.1.0
pip install -r requirements.txt
from telethon import TelegramClient
import telethon.sync

import asyncio
import socks

api_id = PLACE_YOUR_APP_ID_HERE
api_hash = PLACE_YOUR_API_HASH_HERE

# to use with TOR proxy
client = TelegramClient('my_session', api_id, api_hash, proxy=(socks.SOCKS5, 'localhost', 9150))
# to use without proxy
# client = TelegramClient('my_session', api_id, api_hash)

client.start()

def load_messages():
    dialogs = client.get_dialogs()
    chat = None

    for dialog in dialogs:
        if dialog.name == YOUR_GROUP_NAME_HERE:
            chat = dialog
            break

    for message in client.iter_messages(chat):
        if message.media:
            print('Downloading...')
            client.download_media(message)

load_messages()

@Nachtalb
Copy link

@Nachtalb Nachtalb commented May 12, 2019

Would you please implement that feature.

My use-case here is that I want to download some (not all) images from a channel. And as I see it the user-friendliest method to implement it would just be a simple SAVE TO PC button to the bar of buttons on top when you selected some messages. Like this eg.
DeepinScreenshot_select-area_20190512165549

@nicofirst1
Copy link

@nicofirst1 nicofirst1 commented Jun 4, 2019

Are there any news about this?

@vijaychandra800
Copy link

@vijaychandra800 vijaychandra800 commented Jun 5, 2019

Quick tip. It is possible to download media with small python script.

  1. Goto https://my.telegram.org and generate api id and api hash
  2. Install Telethon library with pip3 install telethon
  3. Run following code (replace api_id, api_hash and username with your values):
from telethon import TelegramClient
api_id=123456
api_hash='secretHashYO'
client = TelegramClient('test_session', api_id, api_hash)
client.start()
for message in client.get_message_history('username', limit=25):
    client.download_media(message)

This code downloads media from the last 25 messages from the dialog with username user in current directory.

From which channel/group will it download?

@jesper-bylund
Copy link

@jesper-bylund jesper-bylund commented Nov 4, 2019

Since nobody mentioned it yet, you can export the content of a chat and decide to export images only. You can also select a timeframe so you don't have to download the whole pictures history

image

How is this done? I can't find an export option.

@Nachtalb
Copy link

@Nachtalb Nachtalb commented Nov 4, 2019

How is this done? I can't find an export option.

Three dot menu top right or when you open the chat info again on the top right of that one

@jesper-bylund
Copy link

@jesper-bylund jesper-bylund commented Nov 4, 2019

Strangely not available?

Screenshot 2019-11-04 at 09 45 31

@Speeddymon
Copy link

@Speeddymon Speeddymon commented Nov 4, 2019

Strangely not available?

Screenshot 2019-11-04 at 09 45 31

I'm not surprised that you're not seeing it given that this thread is for the desktop client and you're looking at your phone.......

@jesper-bylund
Copy link

@jesper-bylund jesper-bylund commented Nov 4, 2019

That screenshot is from the desktop client on MacOS.

Version: 5.8 (185085) AppStore

Screenshot 2019-11-04 at 10 24 17

@Nachtalb
Copy link

@Nachtalb Nachtalb commented Nov 4, 2019

There are two desktop clients for mac. This one and one from the app store. The one you are looking at must be from the app store and has no relation to this one. In other words, this is not the place you're looking for.

@Speeddymon
Copy link

@Speeddymon Speeddymon commented Nov 4, 2019

Strange, the original screenshot looks identical to my phone. Apologies for my tone earlier.

Edit: Nice find @Nachtalb !

@jesper-bylund
Copy link

@jesper-bylund jesper-bylund commented Nov 4, 2019

Thank you @Nachtalb !
Don't worry about it @Speeddymon .

@Nachtalb
Copy link

@Nachtalb Nachtalb commented Nov 4, 2019

@Zebradil I just saw realized that you don't use a takeout session in your code-snippet (#1382 (comment)). I would use it / update your code-snippet:

Some of the calls made through the takeout session will have lower flood limits. This is useful if you want to export the data from conversations or mass-download media, since the rate limits will be lower.
https://docs.telethon.dev/en/latest/modules/client.html#telethon.client.account.AccountMethods.takeout

@Zebradil
Copy link

@Zebradil Zebradil commented Nov 14, 2019

Hey @Nachtalb, thanks for pointing that out. I've checked the approach with takeout object and decided to stay with usual client object instead. The reason is that the "takeout" approach requires handling export request, so just replacing client by takeout will break the example, which is meant to be as simple as possible — it is needed just to give an idea of how to approach the solution.

@zignd
Copy link

@zignd zignd commented Jan 4, 2020

For some reason, the built-in exportation option is not downloading all the images from a group I'm in. I ended up creating a script based on the ones on this thread (thank you guys for the snippets), allowing me to search for a chat by name and them downloading all its media. In case it might be helpful for anyone here's the link to the repository: https://github.com/zignd/telegram-media-downloader The usage is quite simple:

$ python main.py --api-id 12345 --api-hash 1ab1ab1ab1ab1ab --chat-title 'Bunker Reborn'

@MenOfWar
Copy link

@MenOfWar MenOfWar commented Jan 24, 2020

+1 for this feature, plz allow download of albums (bulk of 10 pictures for example) at once. thank you

@maxim-kukushkin
Copy link

@maxim-kukushkin maxim-kukushkin commented Apr 26, 2020

Seriously? So much time passed and this issue is still not implemented?? Telegram, when? It's the most obvious thing that had to be available from day 0.

@RememberTheAir
Copy link

@RememberTheAir RememberTheAir commented Apr 26, 2020

@maxim-kukushkin
Copy link

@maxim-kukushkin maxim-kukushkin commented Apr 26, 2020

@RememberTheAir, thanks, that definitely simplifies the saving

However it's still a trick and not what the author asked for. If a person sent me several bunches of photos I may not want to export all of them. Or if it was say several days ago I shouldn't need to remember the date and reproduce it in the dialog window. It should be point and click feature - I look at what I need to save, click it and save it.

@RememberTheAir
Copy link

@RememberTheAir RememberTheAir commented Apr 26, 2020

I guess this issue kind of conflicts with the more recent #6984. Bulk downloading can be done using the export tool, while selectively saving selected images is still something missing. It's related to what one want "bulk downloading" to mean. Since #6984 has not been closed as a duplicate, I guess we can split the two topics (bulk downloading/exporting and saving a selection of images)

@stale
Copy link

@stale stale bot commented Oct 23, 2020

Hey there!

This issue will be automatically closed in 7 days if there would be no activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

@stale stale bot added the stale label Oct 23, 2020
@Speeddymon
Copy link

@Speeddymon Speeddymon commented Oct 23, 2020

Please do not close this.

@stale stale bot removed the stale label Oct 23, 2020
@ElGordoEncodes
Copy link

@ElGordoEncodes ElGordoEncodes commented Oct 30, 2020

I was about to create a new issue, but remembered I could search first. This feature would make even more sense right now, as the latest update features grouping files into a single message. It shouldn't be available only for images, but for any type of file.

Is your feature request related to a problem?

Not really a problem, but something a bit inconvenient. Since the latest update (https://telegram.org/blog/pinned-messages-locations-playlists at the date of writing), Telegram for Android enables the user to select multiple files, be it all of them grouped in a single message, or each in a separate message, and then tap on a single button at the top to download all the selected files at once. On desktop, we still have to click on the download button for all files, one by one.

Describe the solution you'd like

For messages that consist of grouped files, offer a button inside the context menu to download everything contained within that single message. If multiple files are selected, show a Download button at the top, next to the Forward and Delete buttons, that allows for downloading the selected files. If possible, and even better, ask the user where to save the files when the button is pressed (as it happens when right clicking a file -> save file as).

Describe alternatives you've considered

The "alternative" would be to only offer the Download button when selecting multiple files, and discard the option inside the context menu.

Additional context

Since we can now send multiple files grouped in a single message, it's similar to sending zipped files. The advantage here is that you can download individual files if you want, and are not forced to download the whole zip for a single file (which you would have to do if, let's say, you deleted one single file from inside the zip by accident).
Before, we could send both the individual files + a zip file to accomplish this very same system, but now sending an extra zip file shouldn't be required anymore, saving both user's upload bandwitdh and time, and Telegram's server available storage. And this would only be possible by allowing the download of multiple files at once.

@stale
Copy link

@stale stale bot commented Apr 29, 2021

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

@stale stale bot added the stale label Apr 29, 2021
@Croydon

This comment has been minimized.

@Balls0fSteel
Copy link

@Balls0fSteel Balls0fSteel commented Apr 24, 2022

One year later, still a huge issue. Have to export all images, and all content from chats each and every time I wish to save like 10+ pictures. It's a huge pain and an incredible waste of resources on both my and Telegram's side. Please fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests