A possible direct ******* Player...
#1

Edit:

Thanks for the response..
Reply
#2

http://forum.sa-mp.com/showpost.php?...58&postcount=1
Reply
#3

That uses a URL to play the video, what I am trying is to make a one that could play a song by simply searching its name like using /ytplay <name> not by using URL like /ytplay <URL>


If you would simply, read my entire post you would know what I say.

Thanks anyways, for trying.
Reply
#4

https://developers.******.com/youtub...cs/search/list

You need an API key to authorize any request though. Read the documentation to see what you're supposed to extract.

I find it more troublesome than just inputting a simple URL link.
Reply
#5

The end of the url should be .mp3(or anything like that)
Reply
#6

Quote:
Originally Posted by Konstantinos
View Post
https://developers.******.com/youtub...cs/search/list

You need an API key to authorize any request though. Read the documentation to see what you're supposed to extract.

I find it more troublesome than just inputting a simple URL link.
That stuff is complicated... I'd just stay away from it..
Thanks a lot for the quick response, anyways.
+2 reputation.
Reply
#7

Quote:
Originally Posted by SsHady
View Post
That stuff is complicated... I'd just stay away from it..
Thanks a lot for the quick response, anyways.
+2 reputation.
There are other pages that do what you want, why not use those?

****** "******* Search" and you will find many pages that offer a custom search on *******. Many of them are designed VERY simple, thus it would be easy to extract the results using HTTP() and RegEx or even just a for-loop.

EDIT: Look at this: http://www.yvoschaap.com/*******/
You just have to filter the resulting html code for "PlayVideo('XXX'", XXX is your video link - www.youtube.com/watch?v=XXX

It even uses GET which lets you directly get search results from a link.

If you still think this is too complicated, I'm now interested in doing this. So I would, if you don't want to.
Reply
#8

API's for converting ******* video to mp3 or other formats are generally unreliable, sometimes the url returned by API works and sometimes it doesn't. I have tested over 3 different API for this all were unreliable.

Only fully reliable method imo is (requires that your server is hosted on vps/dedi that you have root access to) to host a php script on your vps/dedi that downloads ******* video then converts it to mp3 format then store that mp3 file on your vps and returns url for it.

Here is how I have done it:
Firstly install these two things on your vps :
1. ffmpeg (to convert downloaded video to mp3 format)
2. *******-dl (to download video from *******)

then you can simply use this script to download and convert it then return then link
PHP Code:
<?php
    set_time_limit
(0);
    
$id $_GET['id'];
    
$url "https://www.youtube.com/watch?v=".$id;
    if(!
file_exists("files/$id.mp3"))
    {        
        
exec("*******-dl --extract-audio --audio-format mp3 $url -o files/$id.mp3");        
    }
    
// get title
    
$info json_decode(file_get_contents("https://www.*******.com/oembed?format=json&url=".$url), true);
    if(
$info === null)echo "Invalid link?";
    else echo 
$info['title'];
?>
Firstly place this file for say in path like example.com/yt2mp3.php
Then create a path example.com/files

Now make a http get request from your samp script to example.com/yt2mp3.php?id=XXX
Where XXX is video ID.

Now after execution of script is complete the title will be available via script output and to play the file simply play it from url example.com/files/XXX.mp3 (Where XXX is video ID that was originally passed)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)