PDA

View Full Version : Streaming youtube audio (?)


Romero837
07/10/2017, 03:14 PM
Hi, i wanted a webpage with streaming for youtube audio. I had one but nowadays is offline.

Twizted
07/10/2017, 06:40 PM
Is this (https://github.com/Dayvison/samp-include-youtube-stream) what you are looking for?

Romero837
07/10/2017, 07:15 PM
I used it but nowadays is offline :( http://www.youtubeinmp3.com/fetch/?video= URL YOUTUBE

It's the same URL of this include...

Meller
07/10/2017, 07:20 PM
I used it but nowadays is offline :( http://www.youtubeinmp3.com/fetch/?video= URL YOUTUBE

It's the same URL of this include...

It's not offline, it's up and working.

FuNkYTheGreat
07/10/2017, 07:56 PM
It's not offline, it's up and working.
First check everything then say please, Don't post if you don't know anything !
It's not converting now, It's closed, It redirects you to the ConvertMP3 website, Which can't be worked on SA-MP streaming.

oMa37
07/10/2017, 08:57 PM
You can get it working with some HTTP and JSON stuff, use their API.

SyS
08/10/2017, 08:06 AM
Try this one.

forward RequestYoutube2Mp3( playerid, response_code, data[ ] );
public RequestYoutube2Mp3( playerid, response_code, data[ ] )
{

if( response_code == 200 )
{
new
start_pos = strfind( data, "\"url\":" ) + 9,
end_pos = strfind( data, "\"", .pos = start_pos ),
mp3_coverted_link[ 500 ];

strmid( mp3_coverted_link, data,start_pos,end_pos );
format( mp3_coverted_link, sizeof( mp3_coverted_link ), "http://%s", mp3_coverted_link );
PlayAudioStreamForPlayer( playerid, mp3_coverted_link );
}

else
SendClientMessage( playerid, -1, "Couldn't play the song!!!" );

return 1;

}

PlayYoutubeAudio( playerid, video_link[ ] )
{

new
param_v_idx = strfind( video_link, "?v=" ) + 3,
video_id[ 15 ],
payload[ 55 ];

strmid( video_id, video_link, param_v_idx, strlen( video_link ) );
format( payload, sizeof( payload ), "www.yt-mp3.com/fetch?v=%s&apikey=1234567", video_id );
HTTP( playerid, HTTP_GET, payload, "", "RequestYoutube2Mp3" );

return 1;

}


Call this function like this:


PlayYoutubeAudio( playerid, video_link_here );


for example

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if( !strcmp( "/test", cmdtext, true ) )
{
PlayYoutubeAudio( playerid, "https://www.youtube.com/watch?v=67ZoXo9dN6Q" );
return 1;
}
return 0;
}

Marshall32
13/10/2017, 02:01 PM
Try this one.

forward RequestYoutube2Mp3( playerid, response_code, data[ ] );
public RequestYoutube2Mp3( playerid, response_code, data[ ] )
{

if( response_code == 200 )
{
new
start_pos = strfind( data, "\"url\":" ) + 9,
end_pos = strfind( data, "\"", .pos = start_pos ),
mp3_coverted_link[ 500 ];

strmid( mp3_coverted_link, data,start_pos,end_pos );
format( mp3_coverted_link, sizeof( mp3_coverted_link ), "http://%s", mp3_coverted_link );
PlayAudioStreamForPlayer( playerid, mp3_coverted_link );
}

else
SendClientMessage( playerid, -1, "Couldn't play the song!!!" );

return 1;

}

PlayYoutubeAudio( playerid, video_link[ ] )
{

new
param_v_idx = strfind( video_link, "?v=" ) + 3,
video_id[ 15 ],
payload[ 55 ];

strmid( video_id, video_link, param_v_idx, strlen( video_link ) );
format( payload, sizeof( payload ), "www.yt-mp3.com/fetch?v=%s&apikey=1234567", video_id );
HTTP( playerid, HTTP_GET, payload, "", "RequestYoutube2Mp3" );

return 1;

}


Call this function like this:


PlayYoutubeAudio( playerid, video_link_here );


for example

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if( !strcmp( "/test", cmdtext, true ) )
{
PlayYoutubeAudio( playerid, "https://www.youtube.com/watch?v=67ZoXo9dN6Q" );
return 1;
}
return 0;
}

Wow thank you so much for this. +3 rep