I write this script to allow you to select quality from URL $_GET parameter and also make it fail more gracefully if the stream has been removed from youtube and can no longer be found.
This script has been modified a lot i have changed the following
To use this script you will need to upload it to the www directory of your server that you wish to restream from
**NOTE YOUTUBE STREAMS ARE IP LOCKED SO CAN ONLY BE PLAYED FROM SERVER THAT MADE THE REQUESTS**
If your using XtreamCodes you need to upload to the following directory
/home/xtreamcodes/iptv_xtream_codes/wwwdir
You can then enter the url to the file in your panel it will generate the stream url and redirect to it
http://serverip:port/youtube.php?search=france24,live&quality=95
There is a number of quality options to use
96 = 1080p | FHD
95 = 720p | HD
94 = 480p | SD
93 = 360p | LQ