Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1018456 // youtubeSearch [JSON version which I'm not getting anymore]

JavaX fragment (include)

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 html = loadPageWithUserAgentAndTimeout("https://www.youtube.com/results?search_query=" + urlencode(q), youtubeSearch_userAgent, youtubeSearch_timeout);
  printIndent("XX ", html);
  int i = indexOf(html, [[{"responseContext":]]);
  print(i);
  if (i < 0) null;
  S json = dropSuffix(";", firstLine(substring(html, i)));
  print("Got JSON: " + json);
  ret (L) jsonDecode(json);
}

Author comment

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: 313 / 349
Referenced in: [show references]