├── runtime.txt ├── Procfile ├── requirements.txt ├── Change_log.txt ├── app.json ├── LICENSE ├── README.md ├── .gitignore └── HB.py /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.11.6 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python3 HB.py 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | tgcrypto 2 | pyrogram 3 | pytube 4 | requests 5 | -------------------------------------------------------------------------------- /Change_log.txt: -------------------------------------------------------------------------------- 1 | v0.6 release notes 2 | *THUMBNAIL DOWNLOAD 3 | *FIXED BUGS 4 | 5 | v0.6 release notes 6 | *FIXED BUGS 7 | ⁕PLAYLIST VIDEOS DOWNLOADER IN 720P 8 | 9 | v0.5 release notes 10 | 11 | ⁕ADDED FILE SIZE IN QUALITY BUTTON 12 | ⁕REMOVED 144p,240p,480p 13 | 14 | v0.4 release notes 15 | 16 | ⁕ADDED PROGRESS BAR 17 | ⁕ADDED MUSIC SUPPORT 18 | 19 | v0.3 release notes 20 | 21 | ⁕DOWNLOAD YOUTUBE VIDEOS IN DIFFERENT QUALITIES 22 | ⁕ADDED QUALITY BUTTONS FOR CHOOSING QUALITY 23 | 24 | v0.2 release notes 25 | 26 | ⁕YOUTUBE VIDEOS DOWNLOADER ONLY IN 720P 27 | 28 | v0.1 release notes 29 | 30 | ⁕YOUTUBE VIDEO INFORMATION FINDER 31 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HB YOUTUBE DL BOT", 3 | "description": "HB YOUTUBE DOWNLOADER BOT", 4 | 5 | "keywords": [ 6 | "YOUTUBE", 7 | "TGBOT", 8 | "YTDL", 9 | "VIDEO" 10 | 11 | ], 12 | "logo": "https://telegra.ph/file/e8a39b06fabbfac6bce8f.jpg", 13 | "repository": "https://github.com/hbbots/YOUTUBE-BOT", 14 | "env": { 15 | "WEBHOOK": { 16 | "description": "LEAVE IT", 17 | "value": "ANYTHING" 18 | }, 19 | "BOT_TOKEN": { 20 | "description": "YOUR BOT TOKEN FROM @BotFather", 21 | "value": "" 22 | }, 23 | "API_ID": { 24 | "description": "YOUR API ID, USE @TeleORG_Bot ", 25 | "value": "" 26 | }, 27 | "API_HASH": { 28 | "description": "YOUR API HASH, USE @TeleORG_Bot ", 29 | "value": "" 30 | } 31 | }, 32 | "addons": [ 33 | ], 34 | "buildpacks": [ 35 | { 36 | "url": "heroku/python" 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 hb 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | **_THIS BOT CAN DOWNLOAD YOUTUBE VIDEOS ,AUDIO ,THUMBNAIL AND PLAYLIST 3 | ONE OF THE FASTEST YOUTUBE BOT REPO 4 | THIS BOT CAN DOWNLOAD 900MB VIDEO IN 1minte_** 5 |
8 | How To Use 9 |
21 |
22 |
23 |
24 |
25 |
26 | [](https://heroku.com/deploy?template=https://github.com/hbbots/YOUTUBE-BOT)
27 |
28 |
29 |
30 |
31 | - `API_HASH` Your API Hash from my.telegram.org
32 | - `API_ID` Your API ID from my.telegram.org
33 | - `BOT_TOKEN` Your bot token from @BotFather
34 | - `WEB HOOK` Leave It
35 |
36 |
37 |
38 | #### ADD THESE AS COMMANDS IN BOTFATHER
39 |
40 | ```python
41 | start-TO CHECK WETHER BOT IS 🤩ALIVE
42 | help-To KNOW HOW TO USE ME😇
43 | about -TO KNOW MORE ABOUT ME🤓
44 | source-TO GET SOURCE CODE❤️
45 | ```
46 |
47 |
48 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/HB.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
3 | from pyrogram import Client, filters,emoji
4 | from pyrogram.types import Message
5 |
6 | import requests
7 | HB = Client(
8 | "YOUTUBE Bot",
9 | bot_token = os.environ["BOT_TOKEN"],
10 | api_id = int(os.environ["API_ID"]),
11 | api_hash = os.environ["API_HASH"]
12 | )
13 |
14 | START_TEXT = """**
15 | HI {},
16 | I AM A ADVANCED YOUTUBE DOWNLOADER BOT
17 | I CAN DOWNLOAD YOUTUBE VIDEOS ,THUMBNAIL
18 | AND PLAYLIST VIDEOS....
19 | ONE OF THE SPPEDEST YOUTUBE BOT
20 | I CAN DOWNLOAD 911mb VIDEOS
21 | IN 1min
22 | MADE BY @TELSABOTS**"""
23 |
24 | HELP_TEXT = """**
25 | YOUTUBE VIDEO
26 | SENT ANY URL .......
27 | THEN SELECT AVAILABLE QUALITY
28 |
29 | PLAYLIST
30 | SENT ANY URL .....
31 | THEN WAIT BOT WILL SENT
32 | VIDEOS IN HIGH QUALITY...
33 |
34 | MADE BY @TELSABOTS**
35 | """
36 |
37 | ABOUT_TEXT = """
38 | 🤖BOT :YOUTUBE DOWNLOADER
39 |
40 | 🧑🏼💻DEV🧑🏼💻: @ALLUADDICT
41 |
42 | 📢CHANNEL :@TELSABOTS
43 |
44 | 📝Language : Python3
45 |
46 | 🧰Frame Work : Pyrogram
47 |
48 | 🤩SOURCE : CLICK HERE
49 |
50 |
51 | """
52 |
53 |
54 | START_BUTTONS = InlineKeyboardMarkup(
55 | [[
56 | InlineKeyboardButton('📢CHANNEL📢', url='https://telegram.me/TELSABOTS'),
57 | InlineKeyboardButton('🧑🏼💻DEV🧑🏼💻', url='https://telegram.me/alluaddict')
58 | ],[
59 | InlineKeyboardButton('🆘HELP🆘', callback_data='help'),
60 | InlineKeyboardButton('🤗ABOUT🤗', callback_data='about'),
61 | InlineKeyboardButton('🔐CLOSE🔐', callback_data='close')
62 | ]]
63 | )
64 |
65 |
66 | result_buttons = InlineKeyboardMarkup(
67 | [[
68 | InlineKeyboardButton('📢CHANNEL📢', url='https://telegram.me/TELSABOTS'),
69 | InlineKeyboardButton('🧑🏼💻DEV🧑🏼💻', url='https://telegram.me/alluaddict')
70 | ],[
71 | InlineKeyboardButton('🔐CLOSE🔐', callback_data='close')
72 | ]]
73 | )
74 | HELP_BUTTONS = InlineKeyboardMarkup(
75 | [[
76 | InlineKeyboardButton('📢CHANNEL📢', url='https://telegram.me/TELSABOTS'),
77 | InlineKeyboardButton('🧑🏼💻DEV🧑🏼💻', url='https://telegram.me/alluaddict')
78 | ],[
79 | InlineKeyboardButton('🏡HOME🏡', callback_data='home'),
80 | InlineKeyboardButton('🤗ABOUT🤗', callback_data='about'),
81 | InlineKeyboardButton('🔐CLOSE🔐', callback_data='close')
82 | ]]
83 | )
84 | ABOUT_BUTTONS = InlineKeyboardMarkup(
85 | [[
86 | InlineKeyboardButton('📢CHANNEL📢', url='https://telegram.me/TELSABOTS'),
87 | InlineKeyboardButton('🧑🏼💻DEV🧑🏼💻', url='https://telegram.me/alluaddict')
88 | ],[
89 | InlineKeyboardButton('🏡HOME🏡', callback_data='home'),
90 | InlineKeyboardButton('🆘HELP🆘', callback_data='help'),
91 | InlineKeyboardButton('🔐CLOSE🔐', callback_data='close')
92 | ]]
93 | )
94 |
95 | SOURCE_TEXT = """PRESS SOURCE BUTTON \n WATCH MY VIDEO AND\nCHECK DESCRIPTION FOR SOURCE CODE"""
96 | SOURCE_BUTTONS = InlineKeyboardMarkup(
97 | [[
98 | InlineKeyboardButton('✅SOURCE✅', url='https://youtu.be/xyW5fe0AkXo'),
99 | InlineKeyboardButton('🧑🏼💻DEV🧑🏼💻', url='https://telegram.me/alluaddict')
100 | ],[
101 | InlineKeyboardButton('🔐CLOSE🔐', callback_data='close')
102 | ]]
103 | )
104 |
105 | result_buttons = InlineKeyboardMarkup(
106 | [[
107 | InlineKeyboardButton('📢CHANNEL📢', url='https://telegram.me/TELSABOTS'),
108 | InlineKeyboardButton('🧑🏼💻DEV🧑🏼💻', url='https://telegram.me/alluaddict')
109 | ],[
110 | InlineKeyboardButton('🔐CLOSE🔐', callback_data='close')
111 | ]]
112 | )
113 |
114 | result_text = """**JOIN @TELSABOTS**"""
115 |
116 | @HB.on_message(filters.command(["start"]))
117 | async def start(bot, update):
118 | text = START_TEXT.format(update.from_user.mention)
119 | reply_markup = START_BUTTONS
120 | await update.reply_text(
121 | text=text,
122 | disable_web_page_preview=True,
123 | reply_markup=reply_markup
124 | )
125 |
126 | @HB.on_message(filters.command(["help"]))
127 | async def help_message(bot, update):
128 | text = HELP_TEXT
129 | reply_markup = HELP_BUTTONS
130 | await update.reply_text(
131 | text=text,
132 | disable_web_page_preview=True,
133 | reply_markup=reply_markup
134 | )
135 |
136 | @HB.on_message(filters.command(["about"]))
137 | async def about_message(bot, update):
138 | text = ABOUT_TEXT
139 | reply_markup = ABOUT_BUTTONS
140 | await update.reply_text(
141 | text=text,
142 | disable_web_page_preview=True,
143 | reply_markup=reply_markup
144 | )
145 | @HB.on_message(filters.command(["source"]))
146 | async def about_message(bot, update):
147 | text = SOURCE_TEXT
148 | reply_markup = SOURCE_BUTTONS
149 | await update.reply_text(
150 | text=text,
151 | disable_web_page_preview=True,
152 | reply_markup=reply_markup
153 | )
154 | import os
155 | import math
156 | import time
157 |
158 |
159 | async def progress_for_pyrogram(
160 | current,
161 | total,
162 | ud_type,
163 | message,
164 | start
165 | ):
166 | now = time.time()
167 | diff = now - start
168 | if round(diff % 10.00) == 0 or current == total:
169 | # if round(current / total * 100, 0) % 5 == 0:
170 | percentage = current * 100 / total
171 | speed = current / diff
172 | elapsed_time = round(diff) * 1000
173 | time_to_completion = round((total - current) / speed) * 1000
174 | estimated_total_time = elapsed_time + time_to_completion
175 |
176 | elapsed_time = TimeFormatter(milliseconds=elapsed_time)
177 | estimated_total_time = TimeFormatter(milliseconds=estimated_total_time)
178 |
179 | progress = "[{0}{1}] \n• Percentage : {2}%\n".format(
180 | ''.join([" ▰" for i in range(math.floor(percentage / 10))]),
181 | ''.join(["▱" for i in range(10 - math.floor(percentage / 10))]),
182 | round(percentage, 2))
183 |
184 | tmp = progress + "✅ COMPLETED : {0}\n📂 SIZE : {1}\n⚡️ SPEED : {2}/s\n⏰ ETA : {3}\n".format(
185 | humanbytes(current),
186 | humanbytes(total),
187 | humanbytes(speed),
188 | # elapsed_time if elapsed_time != '' else "0 s",
189 | estimated_total_time if estimated_total_time != '' else "0 s"
190 | )
191 | try:
192 | await message.edit(
193 | text="{}\n{}".format(
194 | ud_type,
195 | tmp
196 | )
197 | )
198 | except:
199 | pass
200 |
201 | def format_bytes(size):
202 | # 2**10 = 1024
203 | power = 2**10
204 | n = 0
205 | power_labels = {0 : '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'}
206 | while size > power:
207 | size /= power
208 | n += 1
209 | return size, power_labels[n]+'B'
210 |
211 | def humanbytes(size):
212 | # https://stackoverflow.com/a/49361727/4723940
213 | # 2**10 = 1024
214 | if not size:
215 | return ""
216 | power = 2**10
217 | n = 0
218 | Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'}
219 | while size > power:
220 | size /= power
221 | n += 1
222 | return str(round(size, 2)) + " " + Dic_powerN[n] + 'B'
223 |
224 |
225 | def TimeFormatter(milliseconds: int) -> str:
226 | seconds, milliseconds = divmod(int(milliseconds), 1000)
227 | minutes, seconds = divmod(seconds, 60)
228 | hours, minutes = divmod(minutes, 60)
229 | days, hours = divmod(hours, 24)
230 | tmp = ((str(days) + "d, ") if days else "") + \
231 | ((str(hours) + "h, ") if hours else "") + \
232 | ((str(minutes) + "m, ") if minutes else "") + \
233 | ((str(seconds) + "s, ") if seconds else "") + \
234 | ((str(milliseconds) + "ms, ") if milliseconds else "")
235 | return tmp[:-2]
236 |
237 | UPLOAD_START = "