Validate existence of youtube video using javascript and jquery

There’s no need to include a description. The title says it all.

[2015-01-22] Update: The snippet has been updated to work with the new youtube urls (which may contain dashes).

5 Comments

Add yours →

  1. Hello,

    First of all, thanks for the simple but effective script.
    Am I allowed to use it freely without contribution?

    Secondly, I found that it doesn’t work with uri’s containing a dash (-) because it isn’t recognized as a word. To solve this you could do something like /^[\w|-]+$/.

    Sincerely,

    Mark Kremer

    • Hello Mark,

      Thanks for letting me know!

      Since this script was written, google added support for dashes in their video tags. I’ll update the snippet accordingly.

      As to your suggestion, it’s close. However, the pipe isn’t needed in a character set.

  2. Hello Wesley,

    I didn’t know that. Just learnt something 🙂

    You didn’t answer my first question though. (“Am I allowed to use it freely without contribution?”)

    PS: The captcha input field text isn’t visible in my browser (Google Chrome). Probably because the field is too small.

    • Sorry, yes. You’re allowed to use it freely. I’d appreciate a link back if possible, but there’s no need for that.

      Re PS: I’m in chrome as well and it seems to be working just fine. Are you zoomed in?

  3. I’m not clear on how to use your code. I tried the following and always get false

Leave a Reply


3 + = eight

©SpoonX 2017