try:
audio_element = doc.find("span", class_="daud")
if audio_element:
audio_source = audio_element.find("source")["src"]
audio_link = "https://dictionary.cambridge.org" + audio_source
await bot.sendAudio(chat_id, audio=audio_link)
else:
await bot.sendMessage(chat_id, "Pronunciation not found")
except Exception as e:
print("Error while handling audio:", str(e))
await bot.sendMessage(chat_id, "An error occurred while fetching pronunciation")
audio_link= https://dictionary.cambridge.org/media/learner-english/uk_pron/u/ukh/ukhho/ukhhok_002.mp3
Output:
Error while handling audio: ('Bad Request: failed to get HTTP URL content', 400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: failed to get HTTP URL content'})