Get youtube video information using javascript and Youtube-API

315 views Asked by At

I'm just working on an AddOn for the Browser Mozilla Firefox that (for testing reasons) should print the current video position of the youtube video, playing in the active tab, to my console.

Until now I've managed to acquire name and url of the active tab by clicking the button of my addon:

var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");

var button = buttons.ActionButton({
    id: "name",
    label: "label",
    icon: {
        "16": "./icon-16.png",
        "32": "./icon-32.png",
        "64": "./icon-64.png",
    },
    onClick: start
});

function start(state) {
    var tabs = require("sdk/tabs");
    var activeTabUrl = tabs.activeTab.url;
    var activeTabTitle = tabs.activeTab.title;
    console.log("TITLE of active tab: " + activeTabTitle);
    console.log("URL of active tab: " + activeTabUrl);
}

I know that I can access the information with the YouTube-API but I don't know how.

I searched the web for several hours now and all that I found were solutions on how to get access to a video I've embedded by myself or through a javascript file in an HTML-Document (A website for example).

But the point is, that I have no such HTML-Document because I make a Firefox AddOn which only consists of my 'main.js' (code on top), the 'package.json' (basic addon information like author or version number) and the three Icon PNGs.

Meanwhile I determined that if I put a standard YouTube-API link like 'https://gdata.youtube.com/feeds/api/videos/Xdwi403Sqe8' into my webbrowsers address bar I get the message 'No longer available'. What does that mean for my Intention?

0

There are 0 answers