Hi
I am making an app in which I want to give an option to the user to upload the youtube link which will be further saved in the database.
However, I am unable to understand which condition to put in order to check whether the link is of youtube only. If not then show an alert by saying “Enter the valid youtube link”.
Kindly help me to solve this.
Hi there,
Maybe you can check if the link contains the word “youtube”.
There is a block for that.
I used the block 'in text “abc” contain “b” ’ but it did not work.
How did you try the block? Could you attach a screenshot?
I went to youtube and shared a video link.
I got this https://youtu.be/V_Kr9OSfDeU
See that it does not contain the text you are looking for and therefore the condition you created will fail.
I tried to put the condition to find only “https://youtu” much of text from the link to but still it did not work.
You are trying to test the Input from the user
so you can get any type of text which you cannot predict.
A user could type “youtube” without the “https:” part. You made the control entirely to the user.
the how will I verify that whether the user is putting youtube link only ?
In addition to that, the true at the end is unnecessary
You need to check the possible combinations not only one. such as youtube.com. www.youtube.com, youtu.be, .....
.
If I were you I would put the possible combinations in a list and then check every entry in the list against user entry.
What is your intention? If you verify that a YouTube link could be valid because it meets all those requirements, it still may not be a link that displays an actual video.
For example, this link is valid (https://www.youtube.com/watch?v=bRzNufidtpY
):
This one, where I change one character, is not (https://www.youtube.com/watch?v=bRzMufidtpY
):
One way to check for valid formatting is to use Javascript (or Thunkable). But that doesn’t address the problem I brought up.
You might just want to search for “youtu” and “.com/”