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_userAgent, youtubeSearch_timeout); new L<Map> out; 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-srE490CFYnD1QodM6YM1Sj0JFIQaG9sZCBtZSBub3cgc29uZw" 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> ret out; }
Began life as a copy of #1007251
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018454 |
Snippet name: | youtubeSearch [dev.] |
Eternal ID of this version: | #1018454/8 |
Text MD5: | a08377bbb2f3e370cca99af336c5e405 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-30 22:23:13 |
Source code size: | 1151 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 372 / 411 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1018456 - youtubeSearch [JSON version which I'm not getting anymore] |