![]() |
Creating a youtube view countdown
Hi,
I want to create a very simple page that shows a countdown to a video getting a certain number of views. At the moment I've been building it in wordpress, but ideally I'd like to build it as a html page. This is what I've done in wordpress so far: I got this code to show the viewcount figure which worked: <code>[ytviews video="DpwgblBeDz4"]</code> then this one to try to show the number of views remaining until it gets to 220k which didn't: <script type="text/javascript"> document.write((220000-(<code>[ytviews video=" DpwgblBeDz4"]</code>))); </script> Any help much appreciated! I'm hoping to get some code that will return the number value. Thanks, |
You don't want it to show views until 220,000
I'm not sure that I fully understand you. |
I'd like to show the number of views to go until it reaches that target. So a calculation that is
=220,000 - (current viewcount on youtube server) at the moment it would return 9077. Each time the page refreshes it would show the views still to go. It would be really cool if it could update in real time! |
I think, the easiest way, is to get video info in JSON format. If you want to use JavaScript, try jQuery.getJSON()... But I prefer PHP:
Code:
<?php |
Thanks - how do I put this into a html page? Sorry, I'm a novice
|
Here is an example:
http://dev.tempz.webatu.com/youtube-test/ PHP Code:
|
| All times are GMT +1. The time now is 03:28 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.