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)

1  
// TODO: check validity
2  
static S extractYouTubeID(S s) {
3  
  if (empty(s)) null;
4  
  int i = indexOfAfter(s, "youtu.be/");
5  
  if (i >= 0)
6  
    ret substring(s, i);
7  
  s = substring(s, indexOf(s, '?')+1);
8  
  try {
9  
    try answer mapGet(decodeHQuery(s), "v");
10  
  } catch {}
11  
  ret s;
12  
}

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: 564 / 616
Version history: 4 change(s)
Referenced in: [show references]