Kodi Community Forum

Full Version: Send a YouTube URL link from a desktop computer or laptop?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys,

I already posted this question in the "Alternative Youtube Plugin" thread since I thought it might be possible to realize it using that addon.

I'm currently looking for a way to send a link to xbmc remotely to make xbmc play that link.

Mainly I'd like to be able to transmit a youtube url via network to the xbmc machine and then the video starts playing.

There was this Firefox extension XBMCfox and a greasemonkey script that tried to get the url of the flv and then used the (deprecated) http api of xbmc to make it play the video. But both stopped working long time ago.

Nowadays one could use the json rpc api but I was too retarded to get the actual video url (of the flv) scraped to send it to xbmc.

I wonder if there would be a way to send a link (like http://www.youtube.com/watch?v=1234567) to the youtube addon and make it care for the rest. I couldn't find a way to use rpc for addons.
Or instead I'd like to be pointed to the right direction so I can scrape the video url by myself and use the rpc api.

Thanks in advance
Lincoln

Edit: Sorry that was the wrong forum...this should have gone to development.
If a mod/admin could move that...thank you
master.lincoln Wrote:Hey guys,

I already posted this question in the "Alternative Youtube Plugin" thread since I thought it might be possible to realize it using that addon.

I'm currently looking for a way to send a link to xbmc remotely to make xbmc play that link.

Mainly I'd like to be able to transmit a youtube url via network to the xbmc machine and then the video starts playing.

There was this Firefox extension XBMCfox and a greasemonkey script that tried to get the url of the flv and then used the (deprecated) http api of xbmc to make it play the video. But both stopped working long time ago.

Nowadays one could use the json rpc api but I was too retarded to get the actual video url (of the flv) scraped to send it to xbmc.

I wonder if there would be a way to send a link (like http://www.youtube.com/watch?v=1234567) to the youtube addon and make it care for the rest. I couldn't find a way to use rpc for addons.
Or instead I'd like to be pointed to the right direction so I can scrape the video url by myself and use the rpc api.

Thanks in advance
Lincoln

Edit: Sorry that was the wrong forum...this should have gone to development.
If a mod/admin could move that...thank you

Hi, just thought I'd reply since your question peeked my interest:

basically what you need to do is trigger something like this from the JSON api:
http://forum.xbmc.org/showpost.php?p=628...tcount=321
and
http://forum.xbmc.org/showpost.php?p=628...tcount=322

but from reading the JSON api thread (http://forum.xbmc.org/showthread.php?tid=68263), the api currently doesnt implement the execute builtin call so this doesn't really seem possible. There also seem to be some conflicting opinions as to whether this will be added
http://forum.xbmc.org/showpost.php?p=584...tcount=290
spiff Wrote:an executebuiltin is definitely on the todo.

http://forum.xbmc.org/showpost.php?p=632...tcount=466
topfs2 Wrote:Nope, execbuiltin is one of those methods jsonrpc really don't want. its impossible to have a proper security clearence for it (except stating the clearance as admin)

So currently, without some help from the devs, your request doesn't seem possible with the JSON api.
I'm on xbmc4xbox, but to send youtube videos or any other streaming video to my xbox, I modded the download helper extension to call the playfile command using the http api. To do this, inside the extension's folder, under components, I edited dhCopyUrlProcessor.js's handle function and added the following:
PHP Code:
var xmlhttp Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]  
                     .
createInstance(Components.interfaces.nsIXMLHttpRequest);  
var 
mediaUrls=Util.encodeURL(mediaUrl);
xmlhttp.open("GET""http://192.168.0.105/xbmcCmds/xbmcHttp?command=playfile&parameter="+mediaUrls,true);
xmlhttp.send(null); 
Now when you select a file and select "copy url", it will execute this request.
I assume the json api supports something similar.
kreach Wrote:I'm on xbmc4xbox, but to send youtube videos or any other streaming video to my xbox, I modded the download helper extension to call the playfile command using the http api. To do this, inside the extension's folder, under components, I edited dhCopyUrlProcessor.js's handle function and added the following:
PHP Code:
var xmlhttp Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]  
                     .
createInstance(Components.interfaces.nsIXMLHttpRequest);  
var 
mediaUrls=Util.encodeURL(mediaUrl);
xmlhttp.open("GET""http://192.168.0.105/xbmcCmds/xbmcHttp?command=playfile&parameter="+mediaUrls,true);
xmlhttp.send(null); 
I assume the json api supports something similar.

Clever!! I will give this a try later on - Thanks Smile
Thanks for pointing me to this great idea...
Although this is a bit too hacky for me I learned from it.

I coded a little script in python that watches the clipboard and then executes a javascript that crawls the website (youtube for now).
I get a working link for the flv.
Then I encode the link so the special characters are exchanged (via urllib.quote() )

But if I append this quoted link to the url you have in your script I get "Error: could not play file" back.

Here's an example link generated:

http://192.168.2.34:8080/xbmcCmds/xbmcHt...%20marbles

(might not be valid anymore...dunno how youtube handles that)

What am I doing wrong?
I think you need to use quote_plus()
I've been wanting to do the same for a while. Between some googling and some guess work, I've finally got the following working:

curl -i -X POST -d '{"jsonrpc": "2.0", "method": "XBMC.Play", "params":{ "file" : "plugin://plugin.video.youtube/?action=play_video&videoid=VIDEOIDFROMYOUTUBEURL" }, "id": 1}' http://xbmc/jsonrpc



IE, If I wanted to watch http://www.youtube.com/watch?v=EK2tWVj6lXw, I'd submit the following JSON rpc:

{"jsonrpc": "2.0", "method": "XBMC.Play", "params":{ "file" : "plugin://plugin.video.youtube/?action=play_video&videoid=EK2tWVj6lXw" }, "id" : 1}

HTH!
Taking this one step further, I've taken the existing Greasemonkey script and updated it to work with the JSON RPC and the updated plugin, so it doesn't need to find a video download URL on it's own.


The updated script that works can be found at http://userscripts.org/scripts/show/92945.
Superb!

How can I do it by typing a URL? That might have to do while I'm using my phone or Chrome Smile
deepseth Wrote:Taking this one step further, I've taken the existing Greasemonkey script and updated it to work with the JSON RPC and the updated plugin, so it doesn't need to find a video download URL on it's own.


The updated script that works can be found at http://userscripts.org/scripts/show/92945.

This works great in Firefox w/ Greasemonkey. Is there any way to get it to work in Chrome?
Yeah, I'd also like to see a chrome version Smile
I'd like to see a way to do it from a smartphone, a la snapstick

http://www.engadget.com/2011/01/04/snaps...this-mont/
Awesome!

+1 for Chrome support!
Can i use this for my Win7 / Xbox (Crossover) to send Webvideo from any Site ??

How to install ? DonĀ“t matter Chrome or Firefox
Was a chrome version of this script ever developed? or an alternative?
Pages: 1 2