links = soup.find_all('div', {'class': 'graph-image'})
for link in links:
a = link.find('a').get('href')
print(a)
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import State, StatesGroup
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.utils import executor
TOKEN = ''
storage = MemoryStorage()
bot = Bot(token=TOKEN)
dp = Dispatcher(bot, storage=storage)
class edit(StatesGroup):
downloader = State()
recognize = State()
@dp.message_handler(commands=['start'], state=None)
async def voice(message: types.Message):
await edit.downloader.set()
await message.reply('кидай mp3')
@dp.message_handler(content_types=['audio'], state=edit.downloader)
async def recognize_song(message: types.Message, state: FSMContext):
file_id = message.audio.file_id
file = await bot.get_file(file_id)
file_path = file.file_path
await bot.download_file(file_path, '123.mp3')
await bot.send_message(message.chat.id, 'Пришлите мне теги в этом формате: title:artist')
await edit.next()
@dp.message_handler(content_types=['text'], state=edit.recognize)
async def sender(message: types.Message, state: FSMContext):
if not ':' in message.text:
await message.reply('напиши теги в верном формате\ntitle:artist')
text = message.text
a1 = (text.split(':')[1])
a2 = (text.split(':')[0])
audio = open('123.mp3', 'rb')
await bot.send_audio(message.chat.id, audio=audio, performer=a1, title=a2)
await state.finish()
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)