Advertisement
Guest User

Untitled

a guest
Jan 9th, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. //==============================================================================
  2. // Youtube Streamer Include by Usrb1n !
  3. // http://forum.sa-mp.com/member.php?u=122322
  4. //==============================================================================
  5. #include <a_http>
  6. forward U2BStream(playerid, response_code, data[]);
  7. new YoutubeID[32];
  8.  
  9. stock YoutubeStream(playerid, vlink[])
  10. {
  11. new videoid[128], YoutubeString[128];
  12. strmid(videoid,vlink,31,44,strlen(vlink));
  13. format(YoutubeString,sizeof(YoutubeString),"www.youtube-mp3.org/api/itemInfo/?video_id=%s",videoid);
  14. strmid(YoutubeID, videoid, 0, 12);
  15. HTTP(playerid,HTTP_GET,YoutubeString,videoid,"U2BStream");
  16. }
  17.  
  18. public U2BStream(playerid, response_code, data[])
  19. {
  20. if(response_code == 200)
  21. {
  22.  
  23. new result[33], u2bstr[33]; new streamedurl[128];
  24. new crypted = strfind(data, "\"h\"", true, -1);
  25. strmid(result,data,crypted+7,crypted+39,strlen(data));
  26. format(u2bstr,sizeof(u2bstr), "%s", result);
  27. format(streamedurl, sizeof(streamedurl), "http://www.youtube-mp3.org/get?video_id=%s&h=%s",YoutubeID, u2bstr);
  28. PlayAudioStreamForPlayer(playerid, streamedurl);
  29. }
  30. else
  31. {
  32. SendClientMessage(playerid, 0xAA3333AA, "Invalid Youtube URL, please try again with other video.");
  33. }
  34. return 1;
  35. }
  36.  
  37. stock YoutubeStopStream(playerid)
  38. {
  39. PlayAudioStreamForPlayer(playerid, "Youtube streaming was stoped.");
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement