tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

Bulk download images

Open Sh4d0wHunt3rX opened this issue 10 years ago • 64 comments

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.

Sh4d0wHunt3rX avatar Dec 12 '15 13:12 Sh4d0wHunt3rX

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

Sh4d0wHunt3rX avatar Mar 04 '16 14:03 Sh4d0wHunt3rX

#809 ?

Aokromes avatar Apr 20 '16 09:04 Aokromes

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

auchri avatar Apr 20 '16 10:04 auchri

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.

Sh4d0wHunt3rX avatar Jun 22 '16 19:06 Sh4d0wHunt3rX

@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...

MasterGroosha avatar Mar 02 '17 13:03 MasterGroosha

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 😞

Sh4d0wHunt3rX avatar Mar 02 '17 15:03 Sh4d0wHunt3rX

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.

Speeddymon avatar Jul 03 '17 20:07 Speeddymon

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.

ghost avatar Sep 12 '17 23:09 ghost

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

Julian1984 avatar Feb 01 '18 10:02 Julian1984

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_history → iter_messages as the former doesn't work anymore.

Zebradil avatar Feb 03 '18 22:02 Zebradil

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

moham96 avatar Feb 22 '18 05:02 moham96

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

ganesh-deshmukh avatar Jul 11 '18 09:07 ganesh-deshmukh

@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.

Zebradil avatar Jul 11 '18 10:07 Zebradil

@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()

drakmail avatar Oct 06 '18 15:10 drakmail

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

Nachtalb avatar May 12 '19 15:05 Nachtalb

Are there any news about this?

nicofirst1 avatar Jun 04 '19 10:06 nicofirst1

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?

vijaychandra800 avatar Jun 05 '19 05:06 vijaychandra800

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

RememberTheAir avatar Jun 05 '19 07:06 RememberTheAir

This is pathetic. The need for this feature should have been obvious the very moment saving an image was conceived (which I guess was when Telegram Desktop was created, given that sending photos in the mobile app probably already existed when the Desktop app was created). It has been explicitly asked for by users for three f****ng years and we are still waiting??

teo1978 avatar Jun 10 '19 17:06 teo1978

@teo1978 is there a pull request for this already? If not, you can go and implement this feature, it’s open source project and authors aren’t obligated to implement everything people ask them.

Zebradil avatar Jun 10 '19 18:06 Zebradil