static L> youTubeSearch(S query) { temp var playwright = tempPlaywright(); ret youTubeSearch(playwright, query); } static L> youTubeSearch(Playwright playwright, S query) { var page = playwrightOpenPage(playwright, appendParamsToURL("https://www.youtube.com/results", search_query := query)); L links1 = page.querySelectorAll("a[href]"); LPairS links = map(links1, l -> pair(l.getAttribute("href"), l.innerHTML())); links = filter(links, l -> startsWith(l.a, "/watch?") && empty(urlParam(l.a, "list"))); links = mapPairsB htmldecode_dropTagsAndComments_trim(links); // Filter out weird links links = filter(links, l -> !containsNewLine(l.b) && nempty(l.b)); ret map(links, l -> WithURL("https://www.youtube.com" + l.a, l.b)); }