👋

Plug-and-Play YouTube videos

YouTube released a new data API a few weeks ago based on Google’s gdata. Reading through the docs to implement it into my YouTube search, I found the option for JSON (in script). With the JSON function you can grab youtube’s videos without having to use a local proxy for AJAX request. The local proxy is needed due to javascript security settings blocking request to other domains, but usually slows the process a lot. Also using server side scripting where the data is grabbed, HTMLized and included is usually to difficult for implementing if you just want to add a few vids somewhere.

I wrote a plug-and-play script to include YouTube videos in your site instantly without having to use local proxies, flash, or any other work around. All you need is to include the javascript and where ever you want to add a few videos - to for example a blog post - you add this code:

How it works

  • you start a function with several settings like the search query, or a username
  • the function loads the JSON from YouTube and executes a script that shows all thumbs in the layer specified
  • you can have the video play as an overlay or redirect to the youtube site

Instructions and examples are on this page. It’s a very early release so options like sorting are not functioning yet.

Posted by on .