{"id":13825517,"url":"https://github.com/TheCaduceus/tg-upload","last_synced_at":"2025-07-08T22:31:18.835Z","repository":{"id":153590166,"uuid":"627265413","full_name":"TheCaduceus/tg-upload","owner":"TheCaduceus","description":"An open-source Python program or a CLI Tool to upload/download files/folders to/from Telegram effortlessly.","archived":true,"fork":false,"pushed_at":"2023-10-16T14:15:29.000Z","size":211,"stargazers_count":190,"open_issues_count":6,"forks_count":54,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-04T09:03:51.880Z","etag":null,"topics":["download","mtproto","pyrogram","python","telegram","tg-upload","upload"],"latest_commit_sha":null,"homepage":"https://thecaduceus.eu.org/tg-upload","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheCaduceus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-04-13T05:44:27.000Z","updated_at":"2024-07-21T19:37:39.000Z","dependencies_parsed_at":"2024-01-13T16:25:37.759Z","dependency_job_id":"cc61c962-9cae-49ec-9f61-5554cc8a6b3a","html_url":"https://github.com/TheCaduceus/tg-upload","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCaduceus%2Ftg-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCaduceus%2Ftg-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCaduceus%2Ftg-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCaduceus%2Ftg-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheCaduceus","download_url":"https://codeload.github.com/TheCaduceus/tg-upload/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225470631,"owners_count":17479366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["download","mtproto","pyrogram","python","telegram","tg-upload","upload"],"created_at":"2024-08-04T09:01:22.619Z","updated_at":"2024-11-20T04:30:29.803Z","avatar_url":"https://github.com/TheCaduceus.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003e📦tg-upload\u003c/h1\u003e\n\u003cb\u003eAn open-source Python program or a CLI Tool to upload/download files/folders to/from Telegram effortlessly.\u003c/b\u003e\n\u003c/div\u003e\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003ci\u003eTransform your Telegram account into personal cloud storage with tg-upload.\u003c/i\u003e\n\u003c/div\u003e\n\n## **📑 INDEX**\n\n* [**⚙️ Installation**](#installation)\n  * [Python \u0026 Git](#i-1)\n  * [Download](#i-2)\n  * [Requirements](#i-3)\n* [**🚩 Options**](#options)\n  * [Connectivity](#flag-1)\n  * [Login](#flag-2)\n  * [File](#flag-3)\n  * [Behaviour](#flag-4)\n  * [Download](#flag-5)\n  * [Utility](#flag-6)\n  * [Misc](#flag-7)\n* [**📝 ENV Variables**](#env)\n* [**🕹️ How to use?**](#how-to-use)\n  * [Get API ID \u0026 HASH](#htu-1)\n  * [Authorization](#htu-2)\n  * [Get Started](#htu-3)\n  * [Caption](#htu-4)\n    * [Dynamic Caption](#htu4.1)\n      * [Variables](#htu4.1.1)\n      * [Path Methods](#htu4.1.2)\n      * [Time Index](#htu4.1.3)\n      * [Decimal Places](#htu4.1.4)\n    * [Formatting Modes](#htu-4.2)\n    * [Caption Templates](#htu-4.3)\n  * [Using Proxy](#htu-5)\n* [**🪧 Limits**](#limits)\n  * [File Size](#l-1)\n  * [Thumbnail](#l-2)\n  * [Caption](#l-3)\n* [**❓ FAQ**](#faq)\n* [**⚒️ Contribution**](#contribution)\n* [**⛑️ Need help!**](#help)\n* [**❤️ Credits \u0026 Thanks**](#credits)\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n\n## ⚙️ Installation\nGit installation is optional if you prefer downloading tg-upload as zip file using the [releases](https://github.com/TheCaduceus/tg-upload/releases) section.\n\u003ca name=\"i-1\"\u003e\u003c/a\u003e\n\n**1.Install Python \u0026 Git:**\n\nFor Windows:\n```\nwinget install Python.Python.3.11\nwinget install Git.Git\n```\nFor Linux:\n```\nsudo apt-get update \u0026\u0026 sudo apt-get install -y python3.11 git pip\n```\nFor macOS:\n```\nbrew install python@3.11 git\n```\nFor Termux:\n```\npkg install python -y\npkg install git -y\n```\n\n\u003ca name=\"i-2\"\u003e\u003c/a\u003e\n\n**2.Download tg-upload:**\n\n- Download as zip from [here](https://github.com/TheCaduceus/tg-upload/releases).\n\n- Use Git:\n```\ngit clone https://github.com/TheCaduceus/tg-upload.git\n```\n\n\u003e Starting from release [v1.0.1](https://github.com/TheCaduceus/tg-upload/releases/tag/v1.0.1), tg-upload no longer supports Termux due to the absence of some required dependencies. You may try an older [release](https://github.com/TheCaduceus/tg-upload/releases/tag/v1.0.0) to enjoy the basic functionalities offered by tg-upload. Hence, any issue related to Termux will be rejected without any further investigation.\n\n**3.Change Directory:**\n\n```\ncd tg-upload\n```\n\n\u003ca name=\"i-3\"\u003e\u003c/a\u003e\n\n**4.Install requirements:**\n\nIf your device already has the required dependencies installed, verify if their version matches the version mentioned in 'requirements.txt'. Otherwise, upgrade them. You can see their version by using the tg-upload's `-v` flag.\n\n```\npip install -r requirements.txt\n```\n\n**5.Run the program:**\n\n```\npython tg-upload.py -h\n```\n\n\u003ca name=\"options\"\u003e\u003c/a\u003e\n\n## 🚩 Options\n**tg-upload provides multiple options known as flags to control the overall behaviour of the program. These flags are categorized as follows:**\n\n\u003ca name=\"flag-1\"\u003e\u003c/a\u003e\n\n**1.CONNECTIVITY FLAGS:**\n\nConnectivity flags control how the program should establish a connection to Telegram servers, thus allowing users to use proxies and IPV6.\n\nHow to configure proxies? [[Learn here](#htu-5)]\n\n```\n--ipv6 - Connect to Telegram using your device’s IPv6, by default IPv4.\n--proxy - The name of the proxy (in proxy.json) to use for connecting to Telegram.\n```\n\n\u003ca name=\"flag-2\"\u003e\u003c/a\u003e\n\n**2.LOGIN FLAGS:**\n\nLogin flags are responsible for controlling the behaviour of the program during the authentication flow.\n\n```\n-p,--profile - The name of your new or existing session.\n--info - Show your Telegram account details as JSON.\n--api_id - Telegram API ID, required to create new session.\n--api_hash - Telegram API HASH, required to create new session.\n--phone - Phone number (in international format), required to login as user.\n--hide_pswd - Hide 2FA password using getpass.\n--bot - Telegram bot token, required to login as bot.\n--logout - Revoke current session and delete session file.\n--login_string - Session string to login without auth \u0026 creating session file.\n--export_string - Generate \u0026 display session string using existing session file.\n--tmp_session - Don't create session file for this login.\n--login_only - Exit immediately after authorization process.\n```\n\n\u003ca name=\"flag-3\"\u003e\u003c/a\u003e\n\n**3.FILE FLAGS:**\n\nFile flags are used to provide information about files/folders.\n\n```\n-l,--path - Path to the file or folder to upload.\n-n,--filename - To upload data with custom name.\n-i,--thumb - Path of thumbnail image to be attached with given file. Pass \"auto\" for random frame or particular frame time (in seconds) to attach it with video as thumbnail.\n-z,--caption - Caption text to be attached with file, markdown \u0026 HTML formatting allowed.\n--duration - Duration of audio/video in seconds. Pass \"-1\" for automatic detection.\n--capjson - Caption name (in caption.json) to attach with given file.\n```\n\n\u003ca name=\"flag-4\"\u003e\u003c/a\u003e\n\n**4.BEHAVIOUR FLAGS:**\n\nBehaviour flags control the transmission’s behaviour.\n\n```\n-c,--chat_id - The identity of the chat to upload the file to can be the username, phone number (in international format), or ID number. By default, Saved Messages.\n--as_photo - Send given file as picture.\n--as_video - Send given file as video.\n--as_audio - Send given file as audio.\n--as_voice - Send given file as voice.\n--as_video_note - Send given file as video note.\n--split - Split file in given bytes and upload.\n--replace - Replace given character or keyword in filename. Requires two arguments including \"text to replace\" \"text to replace from\".\n--reply_to - Send file as reply to given message id.\n--disable_stream - Disable streaming for given video.\n-b,--spoiler - Send media with spoiler animation.\n-y,--self_destruct - Number of seconds (60 or below) after which photo/video will self destruct once seen by receiver.\n--protect - Protect uploaded file from getting forwarded \u0026 saved.\n--parse_mode - Set custom formatting mode for caption.\n-d,--delete_on_done - Delete the given file after task completion.\n-w,--width - Set custom width for video, by default to original video width.\n-e,--height - Set custom height for video, by default to original video height.\n-a,--artist - Set artist name of given audio file.\n-t,--title - Set title of given audio file.\n-s,--silent - Send files silently to given chat.\n-r,--recursive - Upload files recursively if path is a folder.\n--prefix - Add given prefix text to filename (prefix + filename).\n--hash_memory_limit - Limit how much memory should be used to calculate hash in bytes, by default to 1 MB.\n--combine_memory_limit - Limit how much memory should be used to combine files in bytes, by default to 1 MB.\n--split_dir - Set custom directory for saving splitted files.\n--combine_dir - Set custom directory for saving combined files.\n--thumb_dir - Set custom directory for saving thumbnails.\n--no_warn - Don't show warning messages. (DEPRECATED)\n--no_update - Disable checking for updates.\n```\n\u003ca name=\"flag-5\"\u003e\u003c/a\u003e\n\n**5.DOWNLOAD FLAGS:**\n\nList of flags that are usable with tg-upload's download module, while flags with \"(common)\" tag are usable with both upload \u0026 download task.\n\n```\n--dl - Enable download module of tg-upload.\n--links - Telegram file links to be downloaded (separated with space).\n--txt_file - .txt file path containing Telegram file links to be downloaded (1 link / line).\n-j,--auto_combine - Automatically start combining part files after download.\n--range - Find and download messages in between of two given links or message IDs of same chat.\n--chat_id (common) - The identity of the chat to download the file from can be the username, phone number (in international format), or ID number. By default, Saved Messages.\n--msg_id - Identity number of messages to be downloaded (separated with space).\n--filename (common) - To download data with custom name.\n--replace (common) - Replace given character or keyword in filename. Requires two arguments including \"text to replace\" \"text to replace from\".\n--prefix (common) - Add given prefix text to filename (prefix + filename).\n--dl_dir - Change the download directory, by default \"downloads\" in current working directory.\n```\n\n\u003ca name=\"flag-6\"\u003e\u003c/a\u003e\n\n**6.UTILITY FLAGS:**\n\nUtility flags provide an easy way to directly use internal functions used by tg-upload without starting the main client. Therefore, there is no need to create or use an existing session (`--profile`) to use these flags.\n\n```\n--env - Display environment variables, their current value and default value in tabular format.\n--file_info - Show basic file information.\n--hash - Calculate \u0026 display hash of given file.\n--split_file - Split file in given bytes, accepts only size \u0026 requires path using path flag.\n--combine - Restore original file using part files produced by tg-upload. Accepts one or more paths.\n--convert - Convert any image into JPEG format.\n--frame - Capture a frame from a video file at given time \u0026 save as .jpg file, accepts only time (in seconds) \u0026 video file path using path flag.\n```\n\n\u003ca name=\"flag-7\"\u003e\u003c/a\u003e\n\n**7.MISC FLAGS:**\n\nFlags that do not fit in the above categories are listed in this category:\n\n```\n-h, --help - To get help message as well as availabe options.\n--device_model - Overwrite device model before starting client, by default \"tg-upload\".\n--system_version - Overwrite system version before starting client, by default installed python version.\n-v,--version - Display current tg-upload \u0026 dependencies version.\n```\n\n\u003ca name=\"how-to-use\"\u003e\u003c/a\u003e\n\n\u003ca name=\"env\"\u003e\u003c/a\u003e\n\n## 📝 ENV Variables\n\n**Tired of passing values each time using flags? Set flag values in system environment, each flag has its own unique system variable name from which it retrieves the value once detected. The table below shows the variable name, flag it is associated with, and the value it expects.**\n\n|Variable                        |Flag                    |Value           |\n|:------------------------------:|:----------------------:|:--------------:|\n|`TG_UPLOAD_IPV6`                |`--ipv6`                |True or False   |\n|`TG_UPLOAD_PROXY`               |`--proxy`               |Same as flag    |\n|`TG_UPLOAD_PROFILE`             |`--profile`             |Same as flag    |\n|`TG_UPLOAD_INFO`                |`--info`                |True or False   |\n|`TG_UPLOAD_API_ID`              |`--api_id`              |Same as flag    |\n|`TG_UPLOAD_API_HASH`            |`--api_hash`            |Same as flag    |\n|`TG_UPLOAD_PHONE`               |`--phone`               |Same as flag    |\n|`TG_UPLOAD_HIDE_PSWD`           |`--hide_pswd`           |True or False   |\n|`TG_UPLOAD_BOT_TOKEN`           |`--bot`                 |Same as flag    |\n|`TG_UPLOAD_LOGOUT`              |`--logout`              |True or False   |\n|`TG_UPLOAD_SESSION_STRING`      |`--login_string`        |Same as flag    |\n|`TG_UPLOAD_EXPORT_STRING`       |`--export_string`       |True or False   |\n|`TG_UPLOAD_TMP_SESSION`         |`--tmp_session`         |True or False   |\n|`TG_UPLOAD_LOGIN_ONLY`          |`--login_only`          |True or False   |\n|`TG_UPLOAD_PATH`                |`--path`                |Same as flag    |\n|`TG_UPLOAD_FILENAME`            |`--filename`            |Same as flag    |\n|`TG_UPLOAD_THUMB`               |`--thumb`               |Same as flag    |\n|`TG_UPLOAD_CAPTION`             |`--caption`             |Same as flag    |\n|`TG_UPLOAD_DURATION`            |`--duration`            |Same as flag    |\n|`TG_UPLOAD_CAPJSON`             |`--capjson`             |Same as flag    |\n|`TG_UPLOAD_CHAT_ID`             |`--chat_id`             |Same as flag    |\n|`TG_UPLOAD_AS_PHOTO`            |`--as_photo`            |True or False   |\n|`TG_UPLOAD_AS_VIDEO`            |`--as_video`            |True or False   |\n|`TG_UPLOAD_AS_AUDIO`            |`--as_audio`            |True or False   |\n|`TG_UPLOAD_AS_VOICE`            |`--as_voice`            |True or False   |\n|`TG_UPLOAD_AS_VIDEO_NOTE`       |`--as_video_note`       |True or False   |\n|`TG_UPLOAD_SPLIT`               |`--split`               |Same as flag    |\n|`TG_UPLOAD_REPLACE`             |`--replace`             |Separate both values using \",\" (comma).|\n|`TG_UPLOAD_REPLY_TO`            |`--reply_to`            |Same as flag    |\n|`TG_UPLOAD_DISABLE_STREAM`      |`--disable_stream`      |True or False   |\n|`TG_UPLOAD_SPOILER`             |`--spoiler`             |True or False   |\n|`TG_UPLOAD_SELF_DESTRUCT`       |`--self_destruct`       |Same as flag    |\n|`TG_UPLOAD_PROTECT`             |`--protect`             |True or False   |\n|`TG_UPLOAD_PARSE_MODE`          |`--parse_mode`          |Same as flag    |\n|`TG_UPLOAD_DELETE_ON_DONE`      |`--delete_on_done`      |True or False   |\n|`TG_UPLOAD_WIDTH`               |`--width`               |Same as flag    |\n|`TG_UPLOAD_HEIGHT`              |`--height`              |Same as flag    |\n|`TG_UPLOAD_ARTIST`              |`--artist`              |Same as flag    |\n|`TG_UPLOAD_TITLE`               |`--title`               |Same as flag    |\n|`TG_UPLOAD_SILENT`              |`--silent`              |True or False   |\n|`TG_UPLOAD_RECURSIVE`           |`--recursive`           |True or False   |\n|`TG_UPLOAD_PREFIX`              |`--prefix`              |Same as flag    |\n|`TG_UPLOAD_HASH_MEMORY_LIMIT`   |`--hash_memory_limit`   |Same as flag    |\n|`TG_UPLOAD_COMBINE_MEMORY_LIMIT`|`--combine_memory_limit`|Same as flag    |\n|`TG_UPLOAD_SPLIT_DIR`           |`--split_dir`           |Same as flag    |\n|`TG_UPLOAD_COMBINE_DIR`         |`--combine_dir`         |Same as flag    |\n|`TG_UPLOAD_THUMB_DIR`           |`--thumb_dir`           |Same as flag    |\n|`TG_UPLOAD_NO_WARN`             |`--no_warn`             |True or False   |\n|`TG_UPLOAD_NO_UPDATE`           |`--no_update`           |True or False   |\n|`TG_UPLOAD_DL`                  |`--dl`                  |True or False   |\n|`TG_UPLOAD_LINKS`               |`--links`               |Separate both values using \",\" (comma).|\n|`TG_UPLOAD_TXT_FILE`            |`--txt_file`            |Same as flag    |\n|`TG_UPLOAD_AUTO_COMBINE`        |`--auto_combine`        |True or False   |\n|`TG_UPLOAD_RANGE`               |`--range`               |True or False   |\n|`TG_UPLOAD_MSG_ID`              |`--msg_id`              |Separate both values using \",\" (comma).|\n|`TG_UPLOAD_DL_DIR`              |`--dl_dir`              |Same as flag    |\n|`TG_UPLOAD_DEVICE_MODEL`        |`--device_model`        |Same as flag    |\n|`TG_UPLOAD_SYSTEM_VERSION`      |`--system_version`      |Same as flag    |\n\nUsers can set as many variables as they want in any order and can temporarily overwrite a variable’s value by passing the new value using its associated flag.\n\n## 🕹️ How to use?\nFor running python commands we can either use 'python' or 'py', in below examples we will use 'py'.\n\n\u003ca name=\"htu-1\"\u003e\u003c/a\u003e\n\n**1.Create a Telegram app:**\n\nGo to [My Telegram](https://my.telegram.org/apps), create an app, and get its **API_ID** \u0026 **API_HASH**. Save them somewhere secure and treat them as you would your bank password.\n\n\u003ca name=\"htu-2\"\u003e\u003c/a\u003e\n\n**2.Login in tg-upload:**\n\ntg-upload supports logging in as a user (using a phone number or session string) or bot (using a bot token or session string). You must pass the value of your **API_ID** (`--api_id`) \u0026 **API_HASH** (`--api_hash`) and a unique name for your session (`--profile`). To log in as a user, you must pass your phone number (`--phone`), or to log in as a bot, pass the bot token (`--bot`).\n\n```\npy tg-upload.py --profile VALUE --api_id VALUE --api_hash VALUE --phone VALUE --login_only\n```\nFrom now on, whenever you need to perform any task, you just need to pass the profile name (`--profile`) that you used to create your session. You will be logged in without any authentication flow until you terminate the session from the Telegram app.\n\n\u003ca name=\"htu-3\"\u003e\u003c/a\u003e\n\n**3.Get Started:**\n\nHooray! Now you’re all set to use tg-upload. You can try out some sample commands that will help you get started quickly:\n\nGet help \u0026 options:\n\n```\npy tg-upload.py -h\n```\n\nUpload files/folders:\n\n```\npy tg-upload.py --profile VALUE --path VALUE --OTHER OPTIONAL FLAGS\n```\n\nDownload files:\n\n*1.From private/public chats:*\n\n```\npy tg-upload.py --profile VALUE --dl --links LINK...  --OTHER OPTIONAL FLAGS\n```\n\n*2.From Saved Messages:*\n\n```\npy tg-upload.py --profile VALUE --dl --msg_id VALUE --OTHER OPTIONAL FLAGS\n```\n\n*3.From personal chats or by manually providing `chat_id` \u0026 `msg_id`:*\n\n```\npy tg-upload.py --profile VALUE --dl --chat_id phone/username/id --msg_id VALUE --OTHER OPTIONAL FLAGS\n```\nHow to get `chat_id` and `msg_id`? [[Learn here](#faq-8)]\n\nCheck versions:\n\n```\npy tg-upload.py -v\n```\n\n\u003ca name=\"htu-4\"\u003e\u003c/a\u003e\n\n\u003ca name=\"htu4.1\"\u003e\u003c/a\u003e\n\n**4.Dynamic Caption:**\n\ntg-upload provides variables that users can place in a file’s caption to make it dynamic. These variables are automatically replaced with their expected values. Users must place the variable name between {} to define it as a variable in the string. Here is the list of variables that tg-upload offers:\n\n\u003ca name=\"htu4.1.1\"\u003e\u003c/a\u003e\n\n* `{file_name}` - Name of file without its format.\n* `{file_format}` - Format of given file including '.'.\n* `{height}` - Height of video file. *(--as_video only)*\n* `{width}` - Width of video file. *(--as_video only)*\n* `{duration}` - Duration of video or audio file in seconds. *(--as_audio \u0026 --as_video only)*\n* `{path}` - Retrive particular value from path or exact path. *(for advanced users)*\n* `{creation_time[indice]}` - File's creation time.\n* `{modification_time[indice]}` - File's last modification time.\n* `{file_sha256}` - Given file's SHA256.\n* `{file_md5}` - Given file's MD5.\n* `{file_size_b}` - Size of file in bytes.\n* `{file_size_kb}` - Size of file in KB.\n* `{file_size_mb}` - Size of file in MB.\n* `{file_size_gb}` - Size of file in GB.\n\n\u003ca name=\"htu4.1.2\"\u003e\u003c/a\u003e\n\nFile's source variable `{path}` is both a variable and a function. Calling it directly will simply return the full path of the file, while calling it with a given method will return the value associated with that method. Below are the methods that you can call with path:\n* `{path}` - Return exact path of file.\n* `{path.parts}` - A tuple giving access to the path’s various components. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parts)]\n* `{path.drive}` - A string representing the drive letter or name, if any. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.drive)]\n* `{path.root}` - A string representing the (local or global) root, if any. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.root)]\n* `{path.anchor}` - The concatenation of the drive and root. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.anchor)]\n* `{path.parents}` - An immutable sequence providing access to the logical ancestors of the path. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parents)]\n* `{path.parent}` - The logical parent of the path. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parent)]\n* `{path.name}` - A string representing the final path component, excluding the drive and root, if any. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.name)]\n* `{path.suffix}` - The file extension of the final component, if any. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffix)]\n* `{path.suffixes}` - A list of the path’s file extensions. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffixes)]\n* `{path.stem}` - The final path component, without its suffix. [[example](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.stem)]\n\nFor more detailed methods, click [here](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.as_posix). Some methods requires newer Python version.\n\n\u003ca name=\"htu4.1.3\"\u003e\u003c/a\u003e\n\nThe file’s creation/modification time variables `{creation_time}` and `{modification_time}` store multiple values like year, month, day, hour, minute, and second of creation/modification. They all have their own index value inside the variable and should be passed with the variable to get a specific value. If the creation time is unknown, then the last modification time will be passed or vice versa. It also depends on your operating system:\n* `0` - Year of creation/modification.\n* `1` - Month of creation/modification.\n* `2` - Day of creation/modification.\n* `3` - Hour of creation/modification.\n* `4` - Minute of creation/modification.\n* `5` - Second of creation/modification.\n\n\u003ca name=\"htu4.1.4\"\u003e\u003c/a\u003e\n\nAdditionally, we can also limit the number of decimal places to be shown in the file size. For example, to limit the number of decimal places to 2, we need to pass `:.2f` with a variable like `{file_size_mb:.2f}`.\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/87380104/233824278-eed11926-1748-4455-8cb0-cb2cf1ebcdbd.png\"\u003e\n\n\u003c/div\u003e\nJust like plain text, you can also apply the same formatting on variables. Make sure you put all formatting tags outside of {} brackets to prevent any error.\n\nOne variable can be called multiple times in the same caption, and users must prevent writing any other keyword between {} brackets; otherwise, tg-upload will raise a KeyError indicating that the given variable is not yet defined.\n\n\u003ca name=\"htu-4.2\"\u003e\u003c/a\u003e\n\n**5.Formatting Modes:**\n\nFormatting and making captions attractive is cool! But sometimes the filename or output of any variable can mess up our caption by injecting the same tags that are used to format our plain text. To tackle this error, tg-upload provides an option to switch between different formatting modes to prevent the misinterpretation of some tags in our caption.\n\n* `DEFAULT` - Interpret both markdown \u0026 HTML tags in caption.\n* `MARKDOWN` - Interpret only markdown tags and ignore HTML tags in caption.\n* `HTML` - Interpret only HTML tags and ignore markdown tags in caption.\n* `DISABLED` - Interpret nothing, keep caption as it is.\n\nIf you are using the `--caption` flag, then you can switch modes using the `--parse_mode` flag. Otherwise, just change the ‘mode’ key value in ‘caption.json’ in case of `--capjson`.\n\n\u003ca name=\"htu-4.3\"\u003e\u003c/a\u003e\n\n**6.Caption Templates:**\n\nWe can make and save our static and dynamic caption format in ‘caption.json’ with a name (required) and description (optional) so we don’t have to write it again.\n\n1.Open 'caption.json' file and edit it as following:\n\n```json\n{\n  \"captionTemplateName\": {\n    \"text\" : \"main caption text\",\n    \"mode\" : \"DEFAULT\",\n    \"description\" : \"An optional description to make recall easy.\"\n  },\n  ...more caption templates \n}\n```\n\n2.When needed, just mention the caption template name using `--capjson` flag.\n\nJust like the `--caption` flag, the caption template also supports formatting using HTML or markdown. I have already provided some general caption templates to make your work easy! :)\n\n\u003ca name=\"htu-5\"\u003e\u003c/a\u003e\n\n**7.Using Proxy**\n\nUsing a proxy is a completely optional step and can be used to bypass bans imposed by local authorities or for increasing transfer speed.\n\n1.Rename 'proxy-sample.json' to 'proxy.json'\n\n2.Fill the proxy details:\n\n```json\n{\n  \"proxyName\": {\n    \"scheme\": \"proxyScheme\", # like socks5\n    \"hostname\": \"proxyHostname\", # like 192.168.1.1\n    \"port\": 1234, # like 8080, should be integer.\n    \"username\": \"proxyUsername\", # optional, omit or keep empty if not required.\n    \"password\": \"proxyPassword\" # optional, omit or keep empty if not required.\n  },\n  ...more proxies\n}\n```\n\n3.While running tg-upload, just mention the proxy name using `--proxy`.\n\n\u003ca name=\"limits\"\u003e\u003c/a\u003e\n\n## 🪧 Limits\n\n\u003ca name=\"l-1\"\u003e\u003c/a\u003e\n\n**1.File size:**\n\n*Upload Limit:*\n\n- 2GB for bots \u0026 freemium users.\n- 4GB for premium users.\n\n*Download Limit:*\n\n- 4GB for all users \u0026 bots.\n\nTo upload larger files, use the `--split` flag and tg-upload will automatically split all files into the given size. To restore the original file out of part files, simply use the `--combine` flag and tg-upload will restore the original file for you (remember to provide part file paths in ordered form 0,1,2,3…).\n\n\u003ca name=\"l-2\"\u003e\u003c/a\u003e\n\n**2.Thumbnail:**\n\n- ~~Only JPEG format.~~\n- Size should be 200 KB or below.\n- Width \u0026 height should not be more than 320 pixels.\n\nStarting from v1.0.5, tg-upload will automatically convert any other image format into JPEG format. You can also use the `--convert` flag to do it manually and without starting the main client.\n\n\u003ca name=\"l-3\"\u003e\u003c/a\u003e\n\n**3.Caption:**\n\n- 1024 characters for all files \u0026 media.\n\n\u003ca name=\"faq\"\u003e\u003c/a\u003e\n\n## ❓FAQ\n\n**1.Getting `socket.send()`, `OSError()`, `TimeoutError()`, Connection lost/reset…?**\n\nSuch network related issues are most likely a result of a temporarily slow or inconsistent network connection and will eventually disappear automatically.\n\n**2.Can split or combine flags cause file corruption?**\n\nNo, the split and combine flags NEVER cause file corruption unless it’s a user-side mistake like not providing .part file paths in the correct format (0,1,2,3…). tg-upload follows commonly used and trusted techniques to split or combine data.\n\n**3.Files are still usable/accessible in their splitted form?**\n\nYes, some file extensions like .txt, .csv, .json etc. are still usable in their split forms while some file extensions like .mkv, .exe, .mp3 etc. are NOT usable until we combine them back.\n\n**4.For me upload/download speed is slow?**\n\nIn many cases, users expect speed in Mbps while tg-upload shows upload/download speed in MB/s where MB/s \u003e Mbps and this is where users get confused.\n\nIn fact, tg-upload has nothing to do with upload/download speed and it totally depends upon Telegram servers (generally 5-7 MB/s) and your internet connection including proxy. Check the code to understand it in a better way.\n\nTo increase download speed, you must subscribe to Telegram premium to remove the speed limit imposed by Telegram for freemium users.\n\n**5.How tg-upload able to upload/download larger files (upto 2GB \u0026 4GB) using bot profiles while Bot API limit it to just 50MB \u0026 20MB?**\n\nIt’s simple! tg-upload never makes use of the Bot API server which works as an intermediate server to communicate with Telegram’s MTProto. Instead, tg-upload directly uses the MTProto API, making it even faster.\n\n**i.Generally:🐢**\n\nYou (JSON/HTTP) -\u003e Bot API (MTProto) -\u003e Telegram = Smaller \u0026 slower data transfer.\n\n**ii.tg-upload:⚡**\n\nYou (MTProto) -\u003e Telegram = Larger \u0026 direct data transfer.\n\n**6.I don't want to login again and again in different devices! is there any way to use existing session in different devices?**\n\nYes, there are mainly two ways to do the same:\n\n**i.Generate \u0026 use session string:**\n\ntg-upload supports the generation of a session string and login through it. To generate a session string, you can use the `--export_string` flag with the `--profile` flag to mention the profile for which the session string should be generated. Also, upon using a session string, tg-upload never creates a new .session file.\n\n**ii.Carry .session files:**\n\nFor every profile, tg-upload generates a .session file which is the main file that helps you log in to your Telegram account without following the auth flow. Place the .session file in tg-upload’s working directory.\n\n**7.Feels like my .session file or session string is leaked! how I can revoke it to prevent unauthorized usage?**\n\nUse the `--logout` flag of tg-upload to revoke the specified session and omit it from your Telegram Account’s active sessions list. Simply mention the session name using the `--profile` flag and pass the `--logout` flag.\n\n```\npy tg-upload.py --profile xyz --logout\n```\n\n\u003ca name=\"faq-8\"\u003e\u003c/a\u003e\n\n**8.How to get `chat_id` \u0026 `msg_id` to use with tg-upload?**\n\nYou can use third-party Telegram clients that let users to see more details (\u003ca href=\"https://github.com/TheCaduceus/tg-upload/assets/87380104/6aa76de6-14ec-4a5f-b889-186aeb2e175b\"\u003esee image\u003c/a\u003e) of a given message like [OctoGram](https://github.com/OctoGramApp/OctoGram).\n\n**9.Can I send files to a particular topic inside a Telegram community?**\n\nTo do this, you just need to pass the topic identity or identity of any message inside of that topic with the `--reply_to` flag.\n\n**Getting topic identity:**\n\nCopy link of any message inside the topic you want identity of and the link will be in this format `https://t.me/username/topic_id/msg_id` or in case of private chats link will be in this format `https://t.me/c/chat_id/topic_id/msg_id`.\n\n**10.Is `--replace` flag case-sensitive? can it also manipulate file format?**\n\nBe aware that the replace flag is case-sensitive and has full access to the filename, including its format. This means that it can manipulate the file format and even your filename prefix. During download, you should use replace more carefully because if the file is a part file containing `.partX` (an extension allotted by tg-upload) where `X` is any number starting from 0, then replace can even manipulate it.\n\nHowever, it is not going to damage your file content. If you have replaced some unexpected words, you can always rename your file.\n\n\u003ca name=\"contribution\"\u003e\u003c/a\u003e\n\n## ⚒️ Contribution\n\nFeel free to create a PR (to dev branch) if you have any valuable changes like adding new features or fixing bugs and not only limited to:\n\n- Changing print statements' string.\n- Refactoring code using AI tools.\n- Typos in README.\n- File rename.\n- Changing default values unless it causing problems.\n- Deleting existing features.\n\n\u003ca name=\"help\"\u003e\u003c/a\u003e\n\n## ⛑️ Need help!\n\n- Create an [issue](https://github.com/TheCaduceus/tg-upload/issues) on GitHub.\n- [Subscribe](https://t.me/TheCaduceusOfficial) Telegram channel.\n- Ask questions or doubts [here](https://t.me/DrDiscussion).\n- Send a [personal message](https://t.me/TheCaduceusHere) to developer on Telegram.\n- Tag on [Twitter](https://twitter.com/BeingDrCaduceus).\n\n\u003ca name=\"credits\"\u003e\u003c/a\u003e\n\n## ❤️ Credits \u0026 Thanks\n\n[**Dr.Caduceus**](https://github.com/TheCaduceus): Owner \u0026 developer of tg-upload.\u003cbr\u003e\n[**Bing AI**](https://bing.com/chat): For ~~documentaion~~ documentation improvements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheCaduceus%2Ftg-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTheCaduceus%2Ftg-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheCaduceus%2Ftg-upload/lists"}