Nekmo / telegram-upload

Upload and download files from Telegram up to 4 GiB using your account
MIT License
1.07k stars 233 forks source link

Caption chars length #129

Closed fatshotty closed 2 years ago

fatshotty commented 3 years ago

Description

I'm trying to upload file with a caption and thumbnail. Everything works fine, but caption is truncated to 200chars

What I Did

Caption of the uploaded file is truncated to 200chars. Telegram allows 2-4000chars instead

is it possibile to add caption_chars_length to command-line arguments, in order to customize the caption length?

thanks in advance

tissole commented 3 years ago

In the folder _telegramupload search for files.py. Open it in a text editor and modify the line 21 CAPTION_MAX_LENGTH = 200 to a value that suits your needs, then save it.

fatshotty commented 3 years ago

thanks for reply

I saw the code and I found the solution. However I don't want modify the code. Is it possibile add a cli-argument to set the caption_chars_length?

thanks

tissole commented 3 years ago

I don't think is possible, I don't see anything in the documentation. It's up to @Nekmo to implement such a feature. By the way, how is your upload speed when using the script? In my case doesn't seem to pass the 1.5 MB/s (12 Mb/s), even if my connection supports more than that.

fatshotty commented 3 years ago

speed is the same of yours on my side. However, telegram supports 4000chars in caption, I think.

Maybe should I fork and push a pull-request? Hope @Nekmo can have a look into that :)

Thanks

tissole commented 3 years ago

Thanks for the answer, I hope that @Nekmo improves the upload speed in the next versions. Regarding the captions, the limit is 1024 characters, messages have a 4096 chars limit. See this. You could do a pull request.

fatshotty commented 3 years ago

thanks for reply.

I send a pull request setting caption_length to 2000. Wait to talk with Nekmo and you to set the correct value :)

tissole commented 3 years ago

Is too much, TG won't allow it. The max length for captions is 1024. See line 44 from TG source. I run tests with values of more than 1024 and is not working. I get an error "The caption is too long".

fatshotty commented 3 years ago

ok, I'm going to change the value and make a new pullrequest ;)

fatshotty commented 2 years ago

Hi, i've fixed the caption_chars_length set to 1024 thanks

Nekmo commented 2 years ago

Fixed!