B/W Rainbow

October 25, 2007

Play YouTube with FLV player of your choice

Filed under: general,PHP,tools — Palani raja @ 9:34 am
Tags: , ,

Not working anymore, but you are free to explore the code. Updates are welcome.

I have completed alternative way to view YouTube videos with FLV player of your choice (JW FLV player in this case). The flv files will not be download to the server, it streams directly from YouTube .


Download Source


I have updated the script for 2 reasons

  1. Youtube deny if you call the url with file_get_contents() which is replaced with a curl function. So it needs curl now.
  2. Youtube added more http headers and now the index for direct download link is 8 earlier it was 4.

I will update the script soon with the following features

  • No need of allow_url_fopen = on in php.ini
  • Curl dependency to be removed.


  1. It doesn’t work?

    Comment by Stoud — January 16, 2008 @ 11:34 am | Reply

  2. Friend,

    Thank you for your update.

    I just updated my script and it works now. Please download the updated version here.


    Comment by Palani raja — January 18, 2008 @ 4:49 am | Reply

  3. I got this when I tried your example

    Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\TheTunnels\Preview\demo.php on line 8

    Comment by anax — January 19, 2008 @ 2:59 am | Reply

  4. @ anax

    Which means you curl extenstion is not enabled in your xampp setup. Note Xampp will not enable the curl extension by default. Just remove the semicolon(;) before extension=php_curl.dll in php.ini and restart apache services to enable the curl extension.

    HIH 😉

    Comment by Palani raja — January 19, 2008 @ 4:31 am | Reply

  5. thanks for responding so promptly. I came up with 4 php configuration files in my xampp and did your suggested in each of them. Turned apache on and off a couple of times… but still same error. I’ll try again after sleep… I look forward to cracking this.

    And will I be able to use the url in a Playlist for JW flv?

    Comment by anax — January 19, 2008 @ 5:22 am | Reply

  6. @anax

    The following are the important conf for php to run this code

    allow_url_fopen = on
    extension=php_curl.dll ;note there is no semicolon before

    and pls check the same with your phpinfo() output.

    Comment by Palani raja — January 19, 2008 @ 5:44 am | Reply

  7. I missed the php.ini in the apache directory (and had changed 3 elsewhere in XAMPP) – – now your demo is working well 🙂

    I’m not sure what code to add to my playlist…. I grabbed this from the source code of your demo for a Long Blondes youtube vid I’d like

    My player under development is here:

    cheers for your help

    Comment by anax — January 19, 2008 @ 10:11 pm | Reply

  8. Hi

    Thanks for this nice script,,but many times i get the url look like this,
    http://cache.googlevideo.com/get_video?video_id=-Mp115afFIA&origin=lax-v116.lax.youtube.com ,then the flvplayer is not play video,,maybe you have a solution??

    Second question,,is it possible to get the name from artist and songtitel into this script?

    Hope you understand my english,thanks you

    Comment by wil — January 22, 2008 @ 4:14 pm | Reply

  9. your code does not work … not anymore…

    Comment by sam — January 24, 2008 @ 4:34 pm | Reply

  10. thanks for share

    Comment by taytus — January 30, 2008 @ 7:37 pm | Reply

  11. Error while fetching the video for the url [ http://youtube.com/watch?v=Et9ycrfY3jQ ]. Try another eg. http://youtube.com/watch?v=Eu-SCI9Ks_Y

    and the same info for all the urls

    i hoe you can help me

    Comment by taytus — January 30, 2008 @ 7:50 pm | Reply

  12. seems to have stopped working again..

    Comment by jk — February 11, 2008 @ 11:48 am | Reply

  13. may error po ata yung script? na download ko yung *v2.zip kaso nung i try ko may error cya
    Please provide valid YouTube URL. eg. http://youtube.com/watch?v=Et9ycrfY3jQ

    Comment by sdms — February 12, 2008 @ 5:54 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: