wes d2a2ba9e15 first commit | %!s(int64=4) %!d(string=hai) anos | |
---|---|---|
.. | ||
README.md | %!s(int64=4) %!d(string=hai) anos | |
code.cpp | %!s(int64=4) %!d(string=hai) anos | |
unitTest.cpp | %!s(int64=4) %!d(string=hai) anos |
by Matt tags: regex, strings
Given a YouTube URL, extract the video ID and return it as a string. Examples youtubeId("https://www.youtube.com/watch?v=XPEr1cArWRg") ➞ "XPEr1cArWRg" youtubeId("https://youtu.be/BCDEDi5gDPo") ➞ "BCDEDi5gDPo" youtubeId("https://youtube.com/watch?t=4m40s&v=vxP3bY-XxY4") ➞ "vxP3bY-XxY4" Notes All input are valid YouTube links.
Given a YouTube URL, extract the video ID and return it as a string.
youtubeId("https://www.youtube.com/watch?v=XPEr1cArWRg") ➞ "XPEr1cArWRg"
youtubeId("https://youtu.be/BCDEDi5gDPo") ➞ "BCDEDi5gDPo"
youtubeId("https://youtube.com/watch?t=4m40s&v=vxP3bY-XxY4") ➞ "vxP3bY-XxY4"
All input are valid YouTube links.