Solved Take a part from URL and save to variable

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Jul 28, 2020
3
0
0
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:

Code:
replace all "https://www.youtube.com/watch?v=" in {_videoid} with ""
 
Status
Not open for further replies.