Jump to content

Youtube links


Baseplate

Recommended Posts

HyPeX, many bigger servers already have radio scripts where players can listen to an online radio which ofcourse consumes the server's network. By the way, I managed to do this using a PHP script and the API provided above.

i said this just to notice that this should be done carefully on a limited bandswith server, or a server with too many players can cause problems of lag. Notice that one thing is a radio that its a stream and not so big bandwith-consuming and another thing is a youtube video.

Link to comment
go to : https://www.youtube-mp3.org

1- put video link

2- download as mp3

3- put your mp3 file in your resource

4- put this code in client side (client.lua) :

playSound("your-mp3-file.mp3") 

or if you want mp3 file download from HTTP :

fetchRemote 

just upload your mp3 file in http://kiwi6.com/ or any mp3 hosting

This was a reply to NssoR, it fit you as well.

Not sure either to cry or laugh, thanks for nothing.
Link to comment
  • Scripting Moderators

Example:

url = "http://www.youtube.com/watch?v=5dbEhBKGOtY" 
  
fetchRemote ( "http://vm-0.zver.kd.io/a_php/youtube_mp3.php?s=download&v=" .. url, 
    function ( data ) 
        if ( data ) then 
            fetchRemote ( "http://vm-0.zver.kd.io/a_php/youtube_mp3.php?s=play&v=" .. url, 
                function ( data ) 
                    if ( data ) then 
                        outputDebugString ( data ) 
                    end 
                end 
            ) 
        end 
    end 
) 

PHP source:

<?php 
if ( !empty ( $_GET [ "s" ] ) && !empty ( $_GET [ "v" ] ) ) { 
    if ( $_GET [ "s" ] == "download" ) { 
        $result = sFileGetContent ( "http://youtubeinmp3.com/download/?n=1&video=" . $_GET [ "v" ] ); 
        //echo $result; 
        exit ( ); 
    } elseif ( $_GET [ "s" ] == "play" ) { 
        $result = explode ( "\n", sFileGetContent ( "http://youtubeinmp3.com/fetch/?video=" . $_GET [ "v" ] ) ); 
        echo str_replace ( "Location: ", "", $result [ 8 ] ); 
    } 
} else { 
    exit ( "Fail." ); 
} 
  
function sFileGetContent($sUrl) { 
    $sContent = ""; 
    $sUrl = str_replace("http://", "", $sUrl); 
    $_aTmp = explode("/", $sUrl); 
    $sDomain = $_aTmp[0]; 
    $sGet = str_replace($sDomain, "", $sUrl); 
    $fp = fsockopen($sDomain, 80, $errno, $errstr); 
    if (!$fp) { 
    } else { 
        $out = "GET $sGet HTTP/1.0\r\n"; 
        $out .= "Host: $sDomain\r\n"; 
        $out .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204\r\n"; 
        $out .= "Referer: [url=http://$sDomain/]http://$sDomain/[/url]\r\n"; 
        $out .= "Connection: Close\r\n\r\n"; 
        fwrite($fp, $out); 
        while (!feof($fp)) { 
            $sContent .= fgets($fp, 2048); 
        } 
        fclose($fp); 
    } 
    return $sContent; 
} 
?> 

:P

Link to comment
Example:
url = "http://www.youtube.com/watch?v=5dbEhBKGOtY" 
  
fetchRemote ( "http://vm-0.zver.kd.io/a_php/youtube_mp3.php?s=download&v=" .. url, 
    function ( data ) 
        if ( data ) then 
            fetchRemote ( "http://vm-0.zver.kd.io/a_php/youtube_mp3.php?s=play&v=" .. url, 
                function ( data ) 
                    if ( data ) then 
                        outputDebugString ( data ) 
                    end 
                end 
            ) 
        end 
    end 
) 

PHP source:

<?php 
if ( !empty ( $_GET [ "s" ] ) && !empty ( $_GET [ "v" ] ) ) { 
    if ( $_GET [ "s" ] == "download" ) { 
        $result = sFileGetContent ( "http://youtubeinmp3.com/download/?n=1&video=" . $_GET [ "v" ] ); 
        //echo $result; 
        exit ( ); 
    } elseif ( $_GET [ "s" ] == "play" ) { 
        $result = explode ( "\n", sFileGetContent ( "http://youtubeinmp3.com/fetch/?video=" . $_GET [ "v" ] ) ); 
        echo str_replace ( "Location: ", "", $result [ 8 ] ); 
    } 
} else { 
    exit ( "Fail." ); 
} 
  
function sFileGetContent($sUrl) { 
    $sContent = ""; 
    $sUrl = str_replace("http://", "", $sUrl); 
    $_aTmp = explode("/", $sUrl); 
    $sDomain = $_aTmp[0]; 
    $sGet = str_replace($sDomain, "", $sUrl); 
    $fp = fsockopen($sDomain, 80, $errno, $errstr); 
    if (!$fp) { 
    } else { 
        $out = "GET $sGet HTTP/1.0\r\n"; 
        $out .= "Host: $sDomain\r\n"; 
        $out .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204\r\n"; 
        $out .= "Referer: [url=http://$sDomain/]http://$sDomain/[/url]\r\n"; 
        $out .= "Connection: Close\r\n\r\n"; 
        fwrite($fp, $out); 
        while (!feof($fp)) { 
            $sContent .= fgets($fp, 2048); 
        } 
        fclose($fp); 
    } 
    return $sContent; 
} 
?> 

:P

Does it really work?

Link to comment
Example:
url = "http://www.youtube.com/watch?v=5dbEhBKGOtY" 
  
fetchRemote ( "http://vm-0.zver.kd.io/a_php/youtube_mp3.php?s=download&v=" .. url, 
    function ( data ) 
        if ( data ) then 
            fetchRemote ( "http://vm-0.zver.kd.io/a_php/youtube_mp3.php?s=play&v=" .. url, 
                function ( data ) 
                    if ( data ) then 
                        outputDebugString ( data ) 
                    end 
                end 
            ) 
        end 
    end 
) 

PHP source:

<?php 
if ( !empty ( $_GET [ "s" ] ) && !empty ( $_GET [ "v" ] ) ) { 
    if ( $_GET [ "s" ] == "download" ) { 
        $result = sFileGetContent ( "http://youtubeinmp3.com/download/?n=1&video=" . $_GET [ "v" ] ); 
        //echo $result; 
        exit ( ); 
    } elseif ( $_GET [ "s" ] == "play" ) { 
        $result = explode ( "\n", sFileGetContent ( "http://youtubeinmp3.com/fetch/?video=" . $_GET [ "v" ] ) ); 
        echo str_replace ( "Location: ", "", $result [ 8 ] ); 
    } 
} else { 
    exit ( "Fail." ); 
} 
  
function sFileGetContent($sUrl) { 
    $sContent = ""; 
    $sUrl = str_replace("http://", "", $sUrl); 
    $_aTmp = explode("/", $sUrl); 
    $sDomain = $_aTmp[0]; 
    $sGet = str_replace($sDomain, "", $sUrl); 
    $fp = fsockopen($sDomain, 80, $errno, $errstr); 
    if (!$fp) { 
    } else { 
        $out = "GET $sGet HTTP/1.0\r\n"; 
        $out .= "Host: $sDomain\r\n"; 
        $out .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204\r\n"; 
        $out .= "Referer: [url=http://$sDomain/]http://$sDomain/[/url]\r\n"; 
        $out .= "Connection: Close\r\n\r\n"; 
        fwrite($fp, $out); 
        while (!feof($fp)) { 
            $sContent .= fgets($fp, 2048); 
        } 
        fclose($fp); 
    } 
    return $sContent; 
} 
?> 

:P

Does it really work?

Yes, I tested it. Very good work Sarrum :D .

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...