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
Failed to download files from a CDN #598
Comments
Is there any code that always triggers the issue that I can use? Paste a log, maybe? |
The code is exactly InteractiveTelegramClient That you wrote it yourself. |
Okay, any file I can try that always triggers this? I can send a big file to myself and try downloading it and it will fail? |
for example I cannot download media of this channel : https://t.me/akhbarefori/110387 |
just call run() method of InteractiveTelegramClient instance and insert this channel and just type "!dm 110387". |
It correctly downloaded the file for me (I forwarded it to my chat, and then downloaded it). Can you please |
|
As you see after downloading only 1MB, downloading finishes |
Right, you live close to some CDNs and Telegram decided to use those to download the file. So what fails is downloading files from a CDN. |
Is my country a concern? I'm from Iran |
Yeah using Telegram from places like Iran cause some big channels to have the media stored in Content Distributed Networks (CDNs) which Telegram uses for increased speed and to avoid censorship I guess. So the library is failing to fetch the file from there. |
So what about using a proxy? |
Or you could wait until I fix this. But sure, a proxy may work. |
Thanks a lot |
I have same issue and i know that using a proxy works. but when i use proxy the rest of my script (that is uploading the downloaded media on my server) will be very slow so i don't want to use a proxy. so my question is that if my country (IRAN) is concern, why and how the official telegram clients can download these medias without using any proxy by me? |
Because the library (and not the official clients) seems to have a bug regarding CDN files. I don't live anywhere close to a CDN so sadly I can't seem to find a way to test those, I'd need a proxy. |
So don't you have any idea except using proxy? |
No it's not a link (unless a link to the message of a public channel shows the media in your browser, which I'm not sure but might). They give you an ID/hash like combination to download the file. |
Does anyone know of a public proxy I can use that triggers CDN downloads? |
Until I can get a proxy and a link a message of a public channel with some media that triggers the issue, I can't do anything. |
I'm having the same issue right now, I can help you debug if needed, feel free to message me here or on telegram on https://telegram.me/zackpollard. I've been triggering this issue by uploading files to a supergroup and then trying to download them immediately via the telethon library. It gets to byte 1032192 (just below 1MB) and then fails to download that chunk with the following error |
@zackpollard |
@Lonami ah I see, hmmm, is there a way I can contact you privately to discuss this separate issue then as the way we're using the library is a bit different which may be causing the issues (we've modified downloads.py slightly) as we need to download only certain chunks of a file at a time. |
You can contact me on Telegram as @Lonami but make sure to tell me your GitHub username so I know who you are. |
Closes LonamiWebs#1213, LonamiWebs#1195, LonamiWebs#1184, LonamiWebs#1177, LonamiWebs#1172, LonamiWebs#1171, LonamiWebs#1170, LonamiWebs#1169, LonamiWebs#1140, LonamiWebs#1129, LonamiWebs#1125, LonamiWebs#1122, LonamiWebs#1118, LonamiWebs#902, LonamiWebs#877, LonamiWebs#716, LonamiWebs#598, LonamiWebs#537
In order to fix this one has to find a popular-enough channel with media from certain countries (or using a proxy). If the download fails, most likely it's because it's a CDN download. In that case, one will need to implement the code to download files from CDNs with raw API. If anyone is interested on working in this and has a file it can be tested on, leave a comment and I'll provide further instructions. |
Layer 109 added |
I had problem downloading big files. I opened an issue but you said there is no problem. After trying I faced same error. I copy and paste InteractiveTelegramClient into my code and just created an instance by my api_id and ... .
But when downloading big files it only downloads 1MB.
The text was updated successfully, but these errors were encountered: