A dynamic youtube/google video movie page with source code and download zip: so you use it, change it and improve it! (demo here)
It shows Pages of videos according to strings you defined, so you can use it for any type of video page.
Two saturdays in the month I have "daddy day" and my 3 year old son Maarten and me have fun outdoors or indoors.
This saturday "we" decided to stay indoors (bad weather outside) and instead of watching tv or playing puzzles we took the laptop and watched YouTube movies. He really likes YouTube
YouTube can be very educational since you can visualize most every word. You can jump from "trains" to specific trains and verbs related to trains or just click from concept to concept. Maarten can constantly pinpoint other movies he finds interesting. Probably doing something smart in his head. (Ofcourse I am here to prevent him seeing "weird" movies that show up in the results and guide him in the process of discovering).
So while watching the YouTube movies I wanted to show him how we could do some life-improvement and prevent typing the same searches over and over again
PHP, Google Search API, JQuery, PHP-Curl, Caching and Google Ads – I started by copying the pretty much default examples from Google Search API Code voor videos and started explaining to my three year old what I was doing. He was fascinated Then we added some pretty default php curl code for caching the pages and caching the images (since I didnt want to make a call each time). After that I downloaded the default Jquery Tabs Stuff, basically 100% as in the examples while I went with him through the code trying to explain what I was doing.
So within an hour we had this page online, with of course IS pretty quick and dirty code alltogether, but he is delighted with it and I am proud that we made it together. One thing was missing: a revenue stream so he can make his pocketmoney with his own video site So we added a Google-Ad to the top of the page.
Download, Improve and Share!
If you are a dad having your "daddy day", please feel free to download the php file and improve it somewhat with your kids e.g.:
- implement functionality to permantly discard movies which are not suitable for children e.g. storing those IDs in an xml file and/or
- make the movies popup and close with a click).
- adding custom movies that always should be included
make the code work with older versions of PHP which do not support JSON_DECODE (e.g. 4.x.x) (fixed)
During our next weekend we will probably focus on the first thing first: permanently discarding inappropriate movies.
Download MaartensVideoPage (zip)
The two additional library downloads are only ment as a reference check. You should download the libraries from the official sites. They are to be placed in the /LIB directory.
LIB directory (this is the JQuery library and the JQUERY UI library which should be placed in the LIB directory. Download it the JQUERY UI lib here and JQUERY here officially).
LIB RPC directory (you only need these 3 files if you are running an older version of PHP (<5.2) which has no JSON support. These files are available from the XML-RPC Project where you should download them officially).
E-mail Maarten and Me with your improvements and comments
How to use it if you don’t know code:
- download the zip file
- change the variables at the top of the index.php file (notably the search string array and add your own Google API key which you can download for free)
- download Jquery and place it in the lib directory (see notepad.txt in that directory for instructions)
- upload the lot to your webhost
If you see that it works you can change it for any kind of video site you like by changing the search parameters e.g. your music videos, movies, how-to videos, personal videos or just collect your favorites.
v.0.1 = YouTube support, Jquery Tabs and basic implementation on 14-2-2009
v.0.2 = Made it compatible with all PHP versions