Kodi Community Forum

Full Version: Send flash/youtube videos to XBMC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there any scripts to work with dharma, that will let me send flash videos, or just youtube videos to XBMC from my PC which im browsing the web from. If theres a Chrome plugin that would be even more epic, or a greesemonkey script to implement a URL under flash videos...
Check out:
http://forum.xbmc.org/showthread.php?tid=88023

You can use Radbox, a video bookmarking service (with chrome extension in development, I believe), to select video's for later viewing. Popeye's WatchMeLater plugin (with a bit of code changed later in the thread) can then read Radbox's RSS and push the vimeo/youtube videos to their respective plugins in XBMC.
I've created one for Chrome, based off of a YouTube download script, but I couldn't get the URL encoding right so XBMC complained that it couldn't play the video. I'll try to do some more work on it this week to see if I can get it working properly.
http://code.google.com/p/queeup/downloads/list

I just add fancy button.
rest came from http://userscripts.org/scripts/show/92945

Greasemonkey script...
OOo how do I get that Greesemonkey script to work in chrome on OSX 10.5?
It seems to install as an extension, but even activated, it doe snot change any source to youtube Sad
Thought I'd report in since I just got this working on OSX.

I used: http://userscripts.org/scripts/show/101305
under Firefox 4 after installing greasemonkey addon. Went to 'Manager User Scripts' in greasemonkey and added 'xbmc:[email protected]:8080' as xbmchost in the script.

After that, when I played a youtube video, I can goto 'add to' next to 'like' and theres a 'play in xbmc' and 'enqueue in xbmc'.

Selecting play pushes it to xbmc!

I did try to get this script working in chrome but no luck.

The script I linked was updated April 17th, so thats why I chose it.

Edit: I'd like to add that I also tried Radbox:
http://forum.xbmc.org/showthread.php?tid=94535
And it seems to work decent as a straight RSS list. 'Add to Radbox' chrome plugin adds a little radbox logo on the toolbar when youtube, vimeo, etc show up. Exactly the functionality I desire. (no bulky bookmarklet)
So now I have instant push in FF4 to XBMC and instapaper/boxee-style watch me later I can easily use from work, friends computers, etc.
Hello everyone.

I have made a few changes to the greasemonkey script so that it works in Chrome.

This is the first time I have played around with greasmonkey scripts, so there might be better ways of doing this.

It would appear that using "http://url.tld" does not work in Chrome. To fix this, I changed this to:

Code:
// @include        http://youtube.com/*
// @include        http://youtube.com.*/*
// @include        http://*.youtube.com/*
// @include        http://*.youtube.com.*/*

This is obviously not as robust as it could be, but this works for me as it allows http://youtube.com /.com.au, as well as http://www.youtube.com / .com.au

Depending on which country you are in, you might want to add .co.uk or .co.* or whatever other TLDs you use for YouTube.

Again, as this is my first time working with a Chrome userscript, there might be a proper way of including any TLD.

The other changes that I made was to remove unsupported Chrome functions for setting the xbmc_host variable, removing the line "window" as it appears to be a syntax error and forcing the script to run after the page has loaded (@runat document_end).

Full script is here:

Code:
// ==UserScript==
// @name           Chrome YouTube XBMC
// @namespace      chrome_youtube_xbmc
// @run_at         document_end
// @include        http://youtube.com/*
// @include        http://youtube.com.*/*
// @include        http://*.youtube.com/*
// @include        http://*.youtube.com.*/*
// ==/UserScript==

var xbmc_host = 'xbmc:xbmc@host:8080';
var xbmc_url = 'http://' + xbmc_host + '/jsonrpc';

function stopPlaying(){
    GM_xmlhttpRequest({
        method: 'GET',
        url: xbmc_url + 'Stop()'
    });
}

function pausePlaying(){
    GM_xmlhttpRequest({
        method: 'GET',
        url: xbmc_url + 'Pause()'
    });
}

function playMedia(){
    setTimeout(function(){
        querystring = window.location.search.substring(1);
        queryarray = querystring.split("&");
        for (i=0;i<queryarray.length;i++) {
          query = queryarray[i].split("=");
          if (query[0] == "v") {
              GM_xmlhttpRequest({
                  method: 'POST',
                  url: xbmc_url,
                  headers: 'Content-type: application/json',
                  data: '{"jsonrpc": "2.0", "method": "XBMC.Play", "params":{ "file" : "plugin://plugin.video.youtube/?action=play_video&videoid=' + query[1] + '" }, "id" : 1}'
              });
          }
        }
        },
        250
    );
}

setTimeout(function () {
    GM_addStyle("#xbmc_div {border-top: 1px solid #CCCCCC; " +
        "margin: 0px 5px; padding: 5px; color: #666666; " +
        "font-weight: bold; text-align: center}");

    try{
        //window

        var xbmc_play_link = document.createElement('button');
        xbmc_play_link.addEventListener('click', playMedia, false);
        xbmc_play_link.innerHTML = '<span class="yt-uix-button-content">Play on XBMC</span>';
        xbmc_play_link.setAttribute("id", "playXBMC");
        xbmc_play_link.setAttribute("class", "yt-uix-button yt-uix-tooltip");
        xbmc_play_link.setAttribute("type", "button");
        xbmc_play_link.setAttribute("title", "Play this video on your XBMC");
        xbmc_play_link.setAttribute("data-tooltip-title", "Play this video on your XBMC");
        xbmc_play_link.setAttribute("data-tooltip-timer", "170");

        document.getElementById('watch-headline-user-info').appendChild(xbmc_play_link);
    }catch(e){
        console.log(e)
    }
  },
10);
This may not be exactly what you're looking for but the default youtube script already has almost this functionality. Just log into your youtube account while browsing and when you want to watch a vid on xbmc just add it to your "Watch Later". Then open the youtube plugin and you can watch it from there.

It only works for youtube but it's enough for my purposes.