Title: Happy Forever Alone Day (Forever Alone Song) Length: 125 Link: http://www.*******inmp3.com/download/get/?i=u3oY8BRe82Oa1zuSa4tcz24tPvG%2FjSBgfyJu%2FdasyxN6DKuloSqWLtDTzgSApnn75jlDE2WFD7xFkOA29R6w3Q%3D%3D
public *******Response(playerid, response, data[])
{
if(response == 200)
{
if(strfind(data, "No video was found") != -1 || strfind(data, "<meta http-equiv=") != -1)
{
#if defined OnPlay*******Url
OnPlay*******Url(playerid, "\0", 0, -1);
#endif
return;
}
new
title[60],
len[5],
Find
;
Find = strfind(data, "<br/>");
strmid(title, data, 7, Find-1);
strdel(data, 0, Find+5);
Find = strfind(data, "<br/>");
strmid(len, data, 8, Find-1);
strdel(data, 0, Find+11);
strpack(*******_title[playerid], title);
*******_len[playerid] = strval(len);
PlayAudioStreamForPlayer(playerid, data, *******_posX[playerid], *******_posY[playerid], *******_posZ[playerid], *******_distance[playerid], *******_usepos[playerid]);
#if defined *******_USE_TEXTDRAW
PlayerTextDrawSetString(playerid, *******_textdraw[playerid], title);
PlayerTextDrawShow(playerid, *******_textdraw[playerid]);
print("Show");
#endif
#if defined USE_TIMER
*******_timer[playerid] = SetTimerEx("intern_OnStopUrl", strval(len)*1000, false, "d", playerid);
#endif
#if defined OnPlay*******Url
OnPlay*******Url(playerid, title, strval(len), 1);
#endif
}
else
{
#if defined OnPlay*******Url
OnPlay*******Url(playerid, "\0", 0, -2);
#endif
}
}
#include a_http
CMD:lt(playerid)
{
HTTP(playerid, HTTP_GET, "www.*******inmp3.com/fetch/?format=text&video=http://www.youtube.com/watch?v=i62Zjga8JOM", "", "YT_HttpResponse");
return 1;
}
forward YT_HttpResponse(playerid, response, data[]);
public YT_HttpResponse(playerid, response, data[])
{
if(response == 200) //Sucesso (site retornou uma resposta)
{
new pos = strfind(data, "http://", true); //retornar posiзгo inicial do texto "http://"
if(pos != -1) //se houver resultados
{
PlayAudioStreamForPlayer(playerid, data[pos]); //tocar o link data a partir da posiзгo encontrada
}
}
return 1;
}
|
Код:
#include a_http
CMD:lt(playerid)
{
HTTP(playerid, HTTP_GET, "www.*******inmp3.com/fetch/?format=text&video=http://www.youtube.com/watch?v=i62Zjga8JOM", "", "YT_HttpResponse");
return 1;
}
forward YT_HttpResponse(playerid, response, data[]);
public YT_HttpResponse(playerid, response, data[])
{
if(response == 200) //Sucesso (site retornou uma resposta)
{
new pos = strfind(data, "http://", true); //retornar posiзгo inicial do texto "http://"
if(pos != -1) //se houver resultados
{
PlayAudioStreamForPlayer(playerid, data[pos]); //tocar o link data a partir da posiзгo encontrada
}
}
return 1;
}
|