-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Allow >50M audio upload to telegram #23
Comments
Is there a good way how to do it? I know two ways, but all of them are meh https://core.telegram.org/bots/api#sending-files link to telegram documentation, about 50 MB limits |
@EatsLemons you talking about this #13 (comment) ? |
@umputun I will try and create a PR |
Yes, it is. I didn't see that comment with solution |
@umputun an error while loading a large file remains, can try on this article to do (https://habr.com/ru/post/348234/) ? |
I've made some progress on this: https://github.com/chuhlomin/telegram-large-files-upload |
That is working now. Follow instructions in README and it will send large file to a channel or bot. |
I thought the idea would be writing some code in Go which will allow large files upload. The problem I stumbled upon is there are hundreds of Telegram Bot API libraries but I haven't found one for Telegram API, and documentation of Telegram API looks like a foreign language to me so I haven't figured out how to make necessary API calls without a library yet. If somebody would find a Go Telegram API library, it would allow me to fix large files upload relatively easy. |
I tried to do it with go first but gave up. Here are my findings: https://github.com/sdidyk/mtproto – MTProto implementation in Golang, hardcoded https://github.com/cjongseok/mtproto – Telegram MTProto and proxy (over gRPC), haven't tried. https://github.com/Arman92/go-tdlib – promising one, uses https://github.com/tdlib/td, couldn't make it work – reports missing *.h files on build (which are there) |
@chuhlomin could you please help me figure this out? Is MTProto is the thing I should be looking for, is it an only way to access Telegram API? Is TDLib a superset of Telegram API which we could use, or it is something else? |
As I understand it MTProto is a protocol for talking to Telegram servers |
Thanks a lot! I'll give MTProto a shot. If that's possible from Python, I would be able to do the same in Go. |
Three potential candidates for implementation: shelomentsevd/mtproto and cjongseok/mtproto which work with MTProto 1.0 which is deprecated and 9seconds/mtg which is actively developed but I don't know if it's supposed to be used like that. Just for reference, actual (official?) TDLib library for Go is Arman92/go-tdlib. |
Per off-GitHub talk with one library developer, it looks like TDLib is the way to go. |
I like go (and prefer to use it), but in this case does it really matter which language to use? |
I have no objections if you know how to tie it all together. Feel free to proceed. |
I would prefer all of this to stay in go for 2 reasons:
However, if we don't have any other practical choice we may try the py route, but it has to be clearly an optional dependency (set as cli/env) doing just upload of the file and returning back the id, or whatever else API needs. This utility should be called from the primary process as a black box and receives status as the exit code and the id (or whatever else needed) as the last printed (to stdout) line. In case if the cli param (or env) didn't set/passed it should continue to work the way it is doing now. Probably the same failback should be initiated if the upload failed. |
I've spent ~4 hours trying to make TDLib work in Go and I haven't had complete success yet. It seems that using TDLib would require switching docker image to Debian and building the C++ library before compiling the Go program. With I think that executing a program in Python is a simpler option in this particular case: Go code with C++ slows build by orders of magnitude and make Dockerfile ugly. |
Makes sense. As much as I don't like mixing python code with go code, dealing with c++ interop feels even worse. So, let's make it an external call of py script. We will also need a Makefile to prepare py (making sure the proper version installed and install dependencies). |
@chuhlomin to clarify: I'm not doing anything here anymore, it's up to you to proceed. |
As an alternative to Python implementation (#31) now we can try to use native Go xelaj/mtproto. I'll look into it when I'll have time. |
With #19 and #15 in place, it was tested in a few real configurations and works as expected. However, the limitation of 50M for upload feels strange from the user's point of view and we need to allow such big files.
Recently, as a part of radio-t/super-bot#3 I've played with github.com/go-telegram-bot-api/telegram-bot-api library and it seems to provide complete support of all telegram's API functionality, for both bots as well as other parts. @sgaynetdinov - maybe switching to this lib may help you to complete the task.
The text was updated successfully, but these errors were encountered: