Neet-Nestor / Telegram-Media-Downloader

A script allowing you to download images and videos from Telegram web even if the group restricts downloading.
https://greasyfork.org/en/scripts/446342-telegram-media-downloader
GNU General Public License v3.0
1.43k stars 134 forks source link

A simple alternative script (WebK only) #33

Open belext opened 11 months ago

belext commented 11 months ago

Hello!

I was inspired by your work and made an alternative script: GreasyFork

It only works on the WebK version (and redirects to it from WebA). Uses some built-in functions I found in the global objects.

Supports any type of media and auto sets file names and extensions.

Feel free to reuse any parts of this code, as well as adapt it for WebA. I don't plan to add WebA support myself.

tg-down-demo

Neet-Nestor commented 11 months ago

Great, thanks for the contribution! I'll have a look and merge it in if everything looks ok 😉

belext commented 11 months ago

No problem! Though I found an issue with my script: it doesn't assign file extensions for round videos (mp4) and voice messages (ogg). I tried modifying myMedia.file_name (adding an extension to it), but it didn't work (even after I made a deep copy of the object). Looks like the file name is returned by the server as a part of Content-Disposition after a download/id GET request is made. It's strange because at one moment it returned correct file names for me. I'll see if I can fix it in the coming days.

Leo-camp commented 11 months ago

Hello!

I was inspired by your work and made an alternative script: GreasyFork

Attaching the code here as well.

Telegram Web - Allow Saving Content It only works on the WebK version (and redirects to it from WebA). Uses some built-in functions I found in the global objects. Supports any type of media and auto sets file names and extensions.

Feel free to reuse any parts of this code, as well as adapt it for WebA. I don't plan to add WebA support myself.

tg-down-demo

hello ! actulay there is lot of content and i dont want to downlaod ALL and i want to share it to my saved files , can you do that

belext commented 11 months ago

@Leo-camp if you mean you want to unlock Forward Message feature in restricted channels, unfortunately it's not possible at the moment. I did spend a little time trying to add forwarding too, but the function I needed wasn't accessible easily. But I'll try once again today or tomorrow.

As for the file extensions for round videos and voice messages, I couldn't find a solution so far. But at least file names are set correctly, and you can always add .mp4 for videos and .ogg for voice messages manually.

Leo-camp commented 11 months ago

@Leo-camp if you mean you want to unlock Forward Message feature in restricted channels, unfortunately it's not possible at the moment. I did spend a little time trying to add forwarding too, but the function I needed wasn't accessible easily. But I'll try once again today or tomorrow.

As for the file extensions for round videos and voice messages, I couldn't find a solution so far. But at least file names are set correctly, and you can always add .mp4 for videos and .ogg for voice messages manually.

thanku you , if can add forwading messages from restricted group to saved meaage it will be great help

belext commented 11 months ago

@Leo-camp so unfortunately you can't forward messages with noForwards flag (it's restricted from the server side).

But I added batch download of all media from selected messages in version 0.3 of my script. So you can update it on GreasyFork and test.

To the repo owner: I'm sorry that I use this issue for communication purposes. Feel free to close it.

tg-down-demo2

Leo-camp commented 11 months ago

@lls-fan thanks for the answer ,

but i have seen bots on telegram that can clone the video or any message from restricted group and then you can share or download that message easily .

but the only downside is you have copy link of each message or file and paste it in the bot , for it work . so if you can you can find a way to clone a batch of files , (p.s : i have tried sharing grp link to bot but it didn't work) then may be we can share it .

belext commented 11 months ago

@Leo-camp I see, the bots probably download every piece of media from the message and send it again as a new one. But it's not easy to do it in a userscript, since you don't have the backend and can only work with existing Telegram Web functions.

Anyway, I don't plan to spend any more time on new features since I made this script for a friend who wanted an easy solution that worked on the official Web version. I know there are some Telegram apps and patches that have restrictions removed by default. I think I've seen some clients that also allow to forward messages in a way that generates a new post with original author removed. Maybe someone can investigate how it works and try to recreate it in a userscript. But it won't be easy for sure.

Leo-camp commented 11 months ago

@lls-fan ok no problem., but have you tried the patch , which you mention which allow copy messages, does it work

infag67789 commented 11 months ago

image Didnot work mate. thanks

belext commented 11 months ago

@infag67789, if you're using my version of a script, you need to right click the media and then hit Download. Or select multiple messages (using right click - select) and hit the D/L button.

infag67789 commented 11 months ago

Oh great, working. How can i download the caption below the video mate? And next question, how can I download the .json/.apk format? is it using the different script?

Neet-Nestor commented 11 months ago

To the repo owner: I'm sorry that I use this issue for communication purposes. Feel free to close it.

No worry @lls-fan , I will keep this thread open just for my own reference. Unfortunately I'm too busy this week to work on this, but as you also published your version I think people will be able to use both if they want :)

Also, if you would like, feel free to turn this into a PR. Though I have noticed there's a lot of difference and it may take some effort on merge these two scripts.

italo2480 commented 10 months ago

Very good, but when I start downloading the content it displays download canceled by Google Chrome using telegram web K, only files below 1gb can be downloaded mstsc_16 11 2023-09_06_24_763

jdbattlemc commented 10 months ago

Script currently (November 19, 2023) does not work at all.

Asyany commented 8 months ago

it doest work there is no button for downloading

belext commented 8 months ago

it doest work there is no button for downloading

@Asyany, hi there! If you are talking about my script, it still works fine on the latest Telegram WebK version. Tested it just today.

only files below 1gb can be downloaded

@italo2480, this might be an actual issue since I haven't tried downloading big files. But since I use the built-in download function, maybe it's a problem on Telegram's side. UPD: Tested downloading of big restricted files and videos: worked fine for 1.2 GB and 1.8 GB. So there shouldn't be any issues.

schwarzematerie commented 5 months ago

Can you add the option to select all files or a specific amount?