Jump to content

Youtube links


Baseplate

Recommended Posts

Posted
Guys, you're missing a heavy part here, you can actually download this, but you will need to do it client-sided wich is literally impossible, becouse either it would be using server's network to download the music wich it aint good..

No way to that.

430x73_B2E03D_FF9900_000000_000000.png

Some people want it to happen, some wish it would happen, others make it happen.

Posted

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.

Posted
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.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted

That requires so you first convert it manually, then you must copy the link, and that's what he doesn't want to do.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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.
CiTLh.png
  • Moderators
Posted

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

Posted
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?

Posted
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 .

State: Inactive

Posted

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

Yes it works until the API download limit is reached. Is there a way to circumvent that?

or can youtube-mp3.com also be used to get a working url?

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...