try:
await bot.send_message(message.chat.id, 'завантажую')
yt.streams.filter(only_audio=True, abr='160kbps').first().download(f'./{yt._title}', 'name.mp3')
audio = open(f'./{yt._title}/name.mp3', 'rb')
path = f'./{yt._title}/name.mp3'
await bot.send_chat_action(message.chat.id, ChatActions.UPLOAD_DOCUMENT)
await bot.send_audio(message.chat.id, audio=audio, performer=artist, title=name, caption=f'{link1}', parse_mode='MARKDOWN')
await bot.delete_message(message.chat.id, message_id_to_delete)
await bot.delete_message(message.chat.id, message.message_id + 1)
os.remove(path)
except UnboundLocalError:
await bot.send_message(message.chat.id, 'ждать дольше чем обычно')
service_name = 'YOUTUBE_VIDEO'
for key, value in r['entitiesByUniqueId'].items():
if service_name in key:
artist1 = (value['artistName'])
name1 = (value['title'])
break
await bot.send_audio(message.chat.id, audio=audio, performer=artist1, title=name1, caption=f'{link1}', parse_mode='MARKDOWN')
await bot.delete_message(message.chat.id, message_id_to_delete)
await bot.delete_message(message.chat.id, message.message_id + 1)
await bot.delete_message(message.chat.id, message.message_id + 2)
os.remove(path)
except OSError:
yt.streams.filter(only_audio=True, abr='160kbps').first().download(f'./name', 'name.mp3')
audio = open(f'./name/name.mp3', 'rb')
path = f'./name/name.mp3'
await bot.send_chat_action(message.chat.id, ChatActions.UPLOAD_DOCUMENT)
await bot.send_document(message.chat.id, document=audio, caption=f'{link1}', parse_mode='MARKDOWN')
except NetworkError:
audio = open(f'./name/name.mp3', 'rb')
await bot.send_document(message.chat.id, document=audio, caption=f'{link1}', parse_mode='MARKDOWN')
[Errno Expecting value] <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Please Wait... | Cloudflare</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" /><![endif]-->
<style>body{margin:0;padding:0}</style>
Task exception was never retrieved
future: <Task finished name='Task-9' coro=<Dispatcher._process_polling_updates() done, defined at C:\Users\артем\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py:407> exception=AttributeError("'NoneType' object has no attribute 'find'")>
Traceback (most recent call last):
File "C:\Users\артем\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 415, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "C:\Users\артем\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 235, in process_updates
return await asyncio.gather(*tasks)
File "C:\Users\артем\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\артем\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 256, in process_update
return await self.message_handlers.notify(update.message)
File "C:\Users\артем\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\артем\Desktop\valorantstats\main.py", line 35, in stats
agent = soup.find('div', attrs={'class': 'info'}).find('div').text
AttributeError: 'NoneType' object has no attribute 'find'
Traceback (most recent call last):
File "C:\Users\артем\Desktop\bot\main1.py", line 15, in <module>
from db import Database
File "C:\Users\артем\Desktop\bot\db.py", line 8
def userexists(self, user_id):
IndentationError: expected an indented block after 'with' statement on line 6