let response = get(client, &"https://www.youtube.com/results?hl=en&search_query={queryParam}")
return $response.body
-proc extractTitlesAndUrls*(html: string): seq[SearchResult] =
- parseHtml(html).findAll("a").
- filter(a => "watch" in a.attrs["href"] and a.attrs.hasKey "title").
- map(a => (a.attrs["title"], "https://www.youtube.com" & a.attrs["href"]))[..(limit-1)]
+func extractTitlesAndUrls*(html: string): seq[SearchResult] =
+ {.noSideEffect.}:
+ parseHtml(html).findAll("a").
+ filter(a => "watch" in a.attrs["href"] and a.attrs.hasKey "title").
+ map(a => (a.attrs["title"], "https://www.youtube.com" & a.attrs["href"]))[..(limit-1)]
proc presentVideoOptions*(searchResults: seq[SearchResult]) =
echo ""