I am in the process of writing an app that can listen to an audio snippet and then display the song title, artist, and album picture. It is supposed to also display the lyrics or the link to the Shazam website if it is unable to return the lyrics. I used the following website as a resource while doing my development:
https://rudrank.blog/experimenting-with-shazamkit#music-recognition
The code below shows how I get the lyrics of a song that has already been identified. Every time I use my app to get the lyrics, it gives me the following error:
TLS ticket does not fit (6884 > 6144)
https://api.lyrics.ovh/v1/Stray Kids/Thunderous
cannotProcessdata
I would appreciate it greatly if anyone could help me fix this problem and get a valid outcome for the lyrics using the ShazamKit api
struct LyricsAPI {
var resourceURL : URL
var url = "https://api.lyrics.ovh/v1/"
var artist : String
var song : String
init(artist: String, song: String){
self.song = song
self.artist = artist
let completeURL = url + artist + "/" + song
print(completeURL)
if let resourceURL = URL(string: completeURL) {
self.resourceURL = resourceURL
} else {
self.resourceURL = completeURL.getCleanedURL()!
}
}
func fetchLyrics(completion: @escaping(Result<SongDetails, ErrorStatus>)->Void) {
let dataTask = URLSession.shared.dataTask(with: resourceURL) { data, _, _ in
guard let jsonData = data else {
completion(.failure(.noDataAvailable))
return
}
do {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let reponse = try decoder.decode(SongDetails.self, from: jsonData)
completion(.success(reponse))
} catch {
completion(.failure(.cannotProcessdata))
}
}
dataTask.resume()
}}`