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

12
LINES

< > BotCompany Repo | #1009199 // extractYouTubeID - accepts video ID or youtube URL

JavaX fragment (include)

// TODO: check validity
static S extractYouTubeID(S s) {
  if (empty(s)) null;
  int i = indexOfAfter(s, "youtu.be/");
  if (i >= 0)
    ret substring(s, i);
  s = substring(s, indexOf(s, '?')+1);
  try {
    try answer mapGet(decodeHQuery(s), "v");
  } catch {}
  ret s;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009199
Snippet name: extractYouTubeID - accepts video ID or youtube URL
Eternal ID of this version: #1009199/5
Text MD5: bbd47a32979b952789328ba69b70d8a0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-31 00:58:20
Source code size: 284 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 562 / 613
Version history: 4 change(s)
Referenced in: [show references]