I'm working on a small project where you need to enter the URL of a YouTube video to get the thumbnail.
I've looked into the YouTube API for this and it requires you to enter the video ID.
For example:
1) You enter the YouTube URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
2) It takes the video ID, in this case it's dQw4w9WgXcQ and stores it into a variable {_videoid}
3) Taking the variable and contacting the API through an URL: https://img.youtube.com/vi/%{_videoid}%/0.jpg
Does anybody have a method to only put the string after v= into a variable?
Thanks!
[doublepost=1595925633,1595921455][/doublepost]I've found the solution after messing around a bit.
Here's the code if someone is looking for it themselves:
I've looked into the YouTube API for this and it requires you to enter the video ID.
For example:
1) You enter the YouTube URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
2) It takes the video ID, in this case it's dQw4w9WgXcQ and stores it into a variable {_videoid}
3) Taking the variable and contacting the API through an URL: https://img.youtube.com/vi/%{_videoid}%/0.jpg
Does anybody have a method to only put the string after v= into a variable?
Thanks!
[doublepost=1595925633,1595921455][/doublepost]I've found the solution after messing around a bit.
Here's the code if someone is looking for it themselves:
Code:
replace all "https://www.youtube.com/watch?v=" in {_videoid} with ""