Skip to content
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

Caption chars length #129

Closed
fatshotty opened this issue Sep 11, 2021 · 10 comments
Closed

Caption chars length #129

fatshotty opened this issue Sep 11, 2021 · 10 comments
Assignees
Milestone

Comments

@fatshotty
Copy link
Contributor

  • telegram-upload version: 0.4.0
  • Python version: 3.8
  • Operating System: ubuntu 20
  • Dependencies list (run pip freeze):
    cffi==1.14.6
    click==8.0.1
    cryptg==0.2.post4
    hachoir==3.1.2
    pyaes==1.6.1
    pyasn1==0.4.8
    pycparser==2.20
    rsa==4.7.2
    telegram-upload==0.4.0
    Telethon==1.23.0

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
Copy link

tissole commented Sep 11, 2021

In the folder telegram_upload 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
Copy link
Contributor Author

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
Copy link

tissole commented Sep 12, 2021

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
Copy link
Contributor Author

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
Copy link

tissole commented Sep 15, 2021

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
Copy link
Contributor Author

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
Copy link

tissole commented Sep 15, 2021

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
Copy link
Contributor Author

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

@Nekmo Nekmo added this to the v0.6.0 milestone Sep 16, 2021
@Nekmo Nekmo self-assigned this Sep 16, 2021
@Nekmo Nekmo modified the milestones: v0.6.0, v0.5.0 Sep 16, 2021
@fatshotty
Copy link
Contributor Author

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

Nekmo added a commit that referenced this issue Jan 31, 2022
@Nekmo Nekmo closed this as completed Jan 31, 2022
@Nekmo
Copy link
Owner

Nekmo commented Jan 31, 2022

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants