1 | sS youtubeSearch_userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"; |
2 | |
3 | static int youtubeSearch_timeout = toMS_int(20.0); |
4 | |
5 | static L<Map> youtubeSearch(S q) {
|
6 | temp tempLoadingAnim("YouTube search: " + q);
|
7 | S html = loadPageWithUserAgentAndTimeout("https://www.youtube.com/results?search_query=" + urlencode(q), youtubeSearch_userAgent, youtubeSearch_timeout);
|
8 | printIndent("XX ", html);
|
9 | int i = indexOf(html, [[{"responseContext":]]);
|
10 | print(i); |
11 | if (i < 0) null; |
12 | S json = dropSuffix(";", firstLine(substring(html, i)));
|
13 | print("Got JSON: " + json);
|
14 | ret (L) jsonDecode(json); |
15 | } |
Began life as a copy of #1018454
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: | #1018456 |
| Snippet name: | youtubeSearch [JSON version which I'm not getting anymore] |
| Eternal ID of this version: | #1018456/1 |
| Text MD5: | 1f6c2c173e0b5e1985b8e07e41a79c58 |
| 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:16:10 |
| Source code size: | 638 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 572 / 602 |
| Referenced in: | [show references] |