import aiogram
import logging
import requests
from aiogram import Bot, Dispatcher, executor, types
from aiogram.bot.api import TelegramAPIServer
from io import BytesIO
from pytube import YouTube
local_server = TelegramAPIServer.from_base('http://botapi.yoshtexnik.uz:8081/')
bot = Bot(token='5224635844:AAFzcPWPK1GNp4wmp-3oCpkKpHwlImnzeYY', server=local_server)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def send_welcome(message: types.Message):
await message.reply("Salom men YouTube video yuklab beraman")
@dp.message_handler()
async def text_message(message:types.Message):
chat_id=message.chat.id
url = message.text
yt = YouTube(url)
if message.text.startswith== "https://www.youtube.com/" or 'http://www.youtube.com':
await bot.send_message(chat_id, f"*yuklanmoqda*: *{yt.title}*\n " f"*Β©Manba*: [{yt.author}]({yt.channel_url})",parse_mode="Markdown")
await download_youtube_video(url, message,bot)
async def download_youtube_video(url,message,bot):
yt=YouTube(url)
stream=yt.streams.filter(progressive=True, file_extension='mp4')
stream.get_highest_resolution().download(f'{message.chat.id}',f'{message.chat.id}_{yt .title}')
with open(f"{message.chat.id}/{message.chat.id}_{yt.title}",'rb') as video:
await bot.send_video(message.chat.id, video, caption='botimiz orqali yuklab olindi', parse_mode='Markdown')
os.remove(f"{message.chat.id}/{message.chat.id}_{yt.title}")
if name == 'main':
executor.start_polling(dp, skip_updates=True)
#python youtube down 2gb gacha
import logging
import requests
from aiogram import Bot, Dispatcher, executor, types
from aiogram.bot.api import TelegramAPIServer
from io import BytesIO
from pytube import YouTube
local_server = TelegramAPIServer.from_base('http://botapi.yoshtexnik.uz:8081/')
bot = Bot(token='5224635844:AAFzcPWPK1GNp4wmp-3oCpkKpHwlImnzeYY', server=local_server)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def send_welcome(message: types.Message):
await message.reply("Salom men YouTube video yuklab beraman")
@dp.message_handler()
async def text_message(message:types.Message):
chat_id=message.chat.id
url = message.text
yt = YouTube(url)
if message.text.startswith== "https://www.youtube.com/" or 'http://www.youtube.com':
await bot.send_message(chat_id, f"*yuklanmoqda*: *{yt.title}*\n " f"*Β©Manba*: [{yt.author}]({yt.channel_url})",parse_mode="Markdown")
await download_youtube_video(url, message,bot)
async def download_youtube_video(url,message,bot):
yt=YouTube(url)
stream=yt.streams.filter(progressive=True, file_extension='mp4')
stream.get_highest_resolution().download(f'{message.chat.id}',f'{message.chat.id}_{yt .title}')
with open(f"{message.chat.id}/{message.chat.id}_{yt.title}",'rb') as video:
await bot.send_video(message.chat.id, video, caption='botimiz orqali yuklab olindi', parse_mode='Markdown')
os.remove(f"{message.chat.id}/{message.chat.id}_{yt.title}")
if name == 'main':
executor.start_polling(dp, skip_updates=True)
#python youtube down 2gb gacha
Youtube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
π4β€1