YouTube Link Finder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

YouTube Link Finder

YouTube Link Finder please provide a link to the general rules for translating the path to the video into a short link (дайте, пожалуйста, ссылку на общие правила перевода пути к видео youtube в короткую ссылку)

8th Jan 2020, 10:08 PM
Petr
32 Answers
+ 7
Walter Alleyz I ask "what is short link for youtube". Not "how do it":)
9th Jan 2020, 9:06 AM
Petr
+ 7
print(input()[-11:]) 🤔🤔🤔
10th Mar 2020, 7:16 AM
Александр Васильев
Александр Васильев - avatar
+ 6
🌟(Pro)metheus 🇸🇬 Thank you, but I do not need a ready-made solution. I do not know the principle of translation. As if I were doing this with my hands in the address bar
8th Jan 2020, 10:22 PM
Petr
+ 4
8th Jan 2020, 10:24 PM
Petr
+ 4
I did: str = str.split('/') str = str[-1:] hasEqual = str.find('=') print(str if hasEqual != -1 else ...)
9th Jan 2020, 4:21 AM
👨🏼‍💻Walter💻
👨🏼‍💻Walter💻 - avatar
+ 3
In this code coach description of example is wrong, because for https://www.youtube.com/watch?v=RRW2aUSw5vU answer must be RRW2aUSw5vU. But author write: Sample out is RRW2aUSwvU You lost number 5
12th Jan 2020, 7:46 AM
Petr
+ 3
Here is my simple python code.. s=input() if "com" in s: print(s[32:]) else: print(s[17:])
3rd Jun 2020, 8:13 AM
Gaja Lakshmi.J
Gaja Lakshmi.J - avatar
+ 3
Petr One Important fact is that GENERALLY, last 11 letters of link is the youtube ID !!!
30th Aug 2020, 4:16 AM
Jayendra Todawat
Jayendra Todawat - avatar
+ 3
Using C: #include <stdio.h> int main() { char a[100]; char f[12]; int l = 0, i, j = 0; scanf("%s", a); for(i = 0; a[i] != '\0'; i++) { l++; } for(i = l; i > l - 12; i--) { f[j] = a[i]; j++; } for(i = 11; i > 0; i--) { printf("%c", f[i]); } return 0; }
7th Feb 2022, 5:29 PM
GURURAJ KL
GURURAJ KL - avatar
+ 2
You know there are 2 possible youtube link stuff in front of the code. Use str.replace()
8th Jan 2020, 10:18 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
It is supposed to RRW....
8th Jan 2020, 10:25 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
The format of the string can be in "https://www.youtube.com/watch?v=kbxkq_w51PM" or the shortened "https://youtu.be/KMBBjzp5hdc" format. Note how "https://www.youtube.com/watch?v=" and "https://youtu.be/" are unnecessary additions that should be removed.
8th Jan 2020, 10:25 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Hello friends I try this! str=input() if 0<len(str)<32: for i in range(17,len(str)): print(str[i],end="") else: for i in range(32,len(str)): print(str[i],end="")
5th Apr 2020, 3:43 AM
æshrîth.htm
æshrîth.htm - avatar
+ 2
Here is my simple python code s=input() if "com" in s: print(s[32:]) else: print(s[17:])
1st Feb 2022, 7:32 PM
Avrian Shandy
Avrian Shandy - avatar
+ 2
//solution in java import java.util.*; public class Program { public static void main(String[] args) { Scanner in=new Scanner(System.in); String k=in.next(); if(k.lastIndexOf("=")!=-1) System.out.println(k.substring(k.lastIndexOf("=")+1)); else System.out.println(k.substring(k.lastIndexOf("/")+1)); } }
4th Mar 2022, 8:37 PM
kishokkumar s
+ 2
#include <iostream> #include <string> using namespace std; //ADD SWITCH CASE AND GET INPUT FROM USER ARE THE CHANGES NEEDED int main() { string video_link= "https://www.youtube.com/watch?v=kbxkq_w51PM"; int size=video_link.length(); string video_id=""; for(int i=0;i<100;i++) { if(video_link[i]==video_link[30]) { i=i+2; for(int j=i;j<size;j++) { video_id=video_id+video_link[j]; } cout<<video_id<<endl; } } //_______// string video_link1="https://youtu.be/KMBBjzp5hdc"; int size1=video_link1.length(); string video_id1=""; for(int i=0;i<100;i++) { if(video_link1[i]==video_link1[13]) { i=i+4; for(int j=i;j<size1;j++) { video_id1=video_id1+video_link1[j]; } cout<<video_id1; } } }
29th Jul 2022, 4:13 PM
Jinu Sam
Jinu Sam - avatar
+ 1
Hey, guys. My .C code failed in every test case but it's output look just like expected output. Can someone help.. https://www.sololearn.com/Discuss/2183481/?ref=app #include <stdio.h> int main() { char a[42]={0}; int c=32,b=17; for(int I=0;I<=42;I++){ scanf("%c",&a[I]); } if(a[31]!=0){ for(int i=0;i<=11;i++){ printf("%c",a[c]); c++; } }if(a[31]==0){ for(int j=0;j<=11;j++){ printf("%c",a[b]); b++; } } return 0; }
27th Feb 2020, 4:14 AM
高于鈞
高于鈞 - avatar
+ 1
you can solve it by using only the basics of pythonhttps://code.sololearn.com/cg5Oo2XOAt6K/?ref=app
27th Feb 2020, 4:40 PM
Suraj Das
Suraj Das - avatar
+ 1
My python code : x=input() l=len(x) a=x.index("/") if "=" in x: s=x.index("=") print("",x[s+1:l]) if "=" not in x: s1=x.index("/") if "/" in x[s1+3:l]: s2=x[s1+4:l].index("/") sf=s1+s2 print("",x[sf+5:l])
1st Jun 2020, 8:32 PM
Meghachandra P
Meghachandra P - avatar
+ 1
Just wondering out aloud... What is the logic behind setting this question as medium difficulty in Code Coach🧐😗? The solution is effectively an one-liner and someone with basic knowledge of list slicing could do it. 🙄
9th Jun 2020, 7:02 PM
Manish Kumar Mohanty
Manish Kumar Mohanty - avatar