#!/usr/bin/env python3
"""
Recognize vocaroo songs using audd.io API
Change api_token key in post_data variable if you have one, else, you can make
only 10 requests
"""
# E.g. song: Laura Cantrell - The Way It Is
vocaroo_url = "https://vocaroo.com/9WLJWzhBhB1"
lyrics = "I can't help myself at all"
import json
import requests
from urllib import parse
audio_file = f"https://media.vocaroo.com/mp3/{vocaroo_url.split('/')[-1]}"
api_url = f"https://api.audd.io/findLyrics/?q={parse.quote(lyrics)}"
post_data = {
"url": audio_file,
"api_token": "test"
}
response = requests.post(api_url, data=post_data)
text_response = json.loads(response.text)
if text_response["status"] == "success":
for result in text_response["result"]:
print(f"{result['artist']} - {result['title']}")
Results:
Hank Williams Jr. - Whiskey Bent And Hell Bound
The Venus Project - Need / Want
Of Verona - Dark In My Imagination
ZaeHD & CEO - Percocets & Alcohol
The crane wives - Allies or Enemies
Laura Cantrell - The Way It Is
Cody Jinks - Whiskey Bent and Hell Bound
Cooder Graw - Whiskey Bent and Hell Bound
Mark Chesnutt - Whiskey Bent And Hell Bound
Jake&Papa - Where the Wild Things Are
# The correct one is on the list