Nekmo / telegram-upload

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

Telegram premium #159

Closed tapatianbeast closed 1 year ago

tapatianbeast commented 2 years ago

What do you know about telegram premium and his 4gb file size?

simonlkch commented 2 years ago

today, telegram have already release the premium function.

This change is necessary to support 4GB files uploaded by premium accounts. Basiclly, premium accounts have x2 quota to compare the free account such as MAX_FILE_SIZE and CAPTION_MAX_LENGTH become 4GB and 2048

According tg doc, User class have add one more parameter, is_premium True Optional. True, if this user is a Telegram Premium user

ref: https://core.telegram.org/bots/api#user

xd003 commented 2 years ago

@simonlkch To get the premium upload working with increased limits , we just change the _MAX_FILESIZE & _CAPTION_MAXLENGTH in files.py here or need to do some other changes as well ?

simonlkch commented 2 years ago

i dont know how to debug the code. but the concept is right. one more step for checking the user is_premium flag.

simonlkch commented 2 years ago

image

I check the source code, this project is using telethon, in telethon documention, The User Class don't have the is_premium flag. Maybe need telethon to update their library first.

https://docs.telethon.dev/en/stable/quick-references/client-reference.html#users

xd003 commented 2 years ago

@simonlkch thanks for info Picsart_22-06-24_22-12-19-890

I found this on a channel , so going by this if the is_premium flag is only for indentification by bots . It shouldn't really affect us in the uploads i guess ? ( Just guessing i could be very well wrong )

simonlkch commented 2 years ago

just test it, telethon have set the file size limit, so need wait telethon to upgrade

https://github.com/LonamiWebs/Telethon/blob/dd51aea4db90fd255a14e27192e221c70b45e105/telethon/_misc/utils.py#L1057

xd003 commented 2 years ago

@simonlkch Can't we just easily fork & edit that condition & then install our own version of telethon ?

pip3 install -U https://github.com/$username/telethon/archive/master.zip

Also on being asked that the premium flag is missing in telethon official group , they replied this - "because premium is implemented in a layer newer than the layer the docs are written for"

simonlkch commented 2 years ago

never say never, you can modify and try it

xd003 commented 2 years ago

never say never, you can modify and try it

Yes indeed , thanks to all people who helped me, it should be working fine now in my fork , here it is if you need - pip install https://github.com/xd003/tg/archive/master.zip

Just make sure to uninstall telethon before installing

tapatianbeast commented 2 years ago

This is safe? Do you fix the new format of url private channels/groups error?

xd003 commented 2 years ago

This is safe? Do you fix the new format of url private channels/groups error?

ID works so using that , dunno about invite url

simonlkch commented 2 years ago

@simonlkch Can't we just easily fork & edit that condition & then install our own version of telethon ?

pip3 install -U https://github.com/$username/telethon/archive/master.zip

Also on being asked that the premium flag is missing in telethon official group , they replied this - "because premium is implemented in a layer newer than the layer the docs are written for"

Thats means install yoru version of the module?

xd003 commented 2 years ago

Thats means install yoru version of the module?

yes

tapatianbeast commented 2 years ago

Thats means install yoru version of the module?

yes

It didn't work for me, I hope Neko updates the official version

Nideapum commented 1 year ago

never say never, you can modify and try it

Yes indeed , thanks to all people who helped me, it should be working fine now in my fork , here it is if you need - pip install https://github.com/xd003/tg/archive/master.zip

Just make sure to uninstall telethon before installing

Thanks, It works for me.

santosadrian commented 1 year ago

Thank you very much, now I can upload files up to 4GB. TY sir.

Nekmo commented 1 year ago

Fixed in version v0.7.0.