sS youtubeSearch_userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:40.0) Gecko/20100101 Firefox/40.1";
static int youtubeSearch_timeout = toMS_int(20.0);
static L<Map> youtubeSearch(S q) {
temp tempLoadingAnim("YouTube search: " + q);
S pageURL = "https://www.youtube.com/results?search_query=" +
urlencode(q);
S html = loadPageWithUserAgentAndTimeout(pageURL, youtubeSearch_u
serAgent, youtubeSearch_timeout);
for (LS ahref : findContainerTag(html, 'a)) {
continue unless contains(containerTagGet(ahref, 'class), "tile
-link");
S url = makeAbsoluteURL(pageURL, containerTagGet(ahref, 'href
));
S text = htmldecode(dropAllTags(join(ahref)));
out.add(litorderedmap(+url, +text));
//<a href="/watch?v=CZ9nPidefaQ" class="yt-uix-tile-link yt-ui
-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink spf-link " data
-sessionlink="itct=CDMQ3DAYEyITCIqQ-srE490CFYnD1QodM6YM1Sj0JFIQaG9s
ZCBtZSBub3cgc29uZw" title="Thompson Twins - Hold Me Now (Lyrics)
[HQ]" aria-describedby="description-id-621161" rel="spf-prefetch"
dir="ltr">Thompson Twins - Hold Me Now (Lyrics) [HQ]</a>