- if let lyricsUrlString = jsonResponse["url"] as? String {
- if let lyricsUrl = URL(string: lyricsUrlString) {
-
- // At this point we have a valid wiki url
- self.fetchLyricsFromPage(withURL: lyricsUrl, completionHandler: completionHandler)
- return
+ if let hits = jsonResponse["hits"] as? [Any] {
+ if let firstHit = hits[0] as? [String: Any] {
+ if let firstHitData = firstHit["result"] as? [String: Any] {
+ if let lyricsUrlString = firstHitData["url"] as? String {
+ if let lyricsUrl = URL(string: lyricsUrlString) {
+
+ // At this point we have a valid wiki url
+ self.fetchLyricsFromPage(withURL: lyricsUrl, completionHandler: completionHandler)
+ return
+ }
+ }
+ }