Thursday, September 20, 2007
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 alot. 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 video’s 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:
<div id="youtubeDiv">
<script>
insertVideos(’youtubeDiv’,’search’,’madonna’,’15’,1);
</script>
</div>
How it works
Instructions and examples are on this page. It’s a very early release so options like sorting are not functioning yet.
[ home ]

