1

I'm working on a Google Chrome extension to notify users when I publish Youtube video. There is only a background script. I would like to do it without any authentification, but I didn't find how. Would it be possible to use something like this code?

var xhr = new XMLHttpRequest();

xhr.open('GET', requestJSON, true);

xhr.onreadystatechange = function()
{
    if (xhr.readyState == 4 && xhr.status == 200)
    {
        var response = JSON.parse(xhr.responseText);

        // if new youtube video then notify
    }
}
Nucktrooper
  • 245
  • 1
  • 15

1 Answers1

2

You could use RSS feeds for channels for this, periodically polling them.

https://www.youtube.com/feeds/videos.xml?channel_id=XXXX

This doesn't require any authentication.

Credit goes to this answer.


Alternatively, requests to YouTube Data API for public playlists (and Uploads is such a playlist) do not seem to require user-authentication, but does require you to register for an API key. youtube.playlistItems.list request seems to fit the bill.

Community
  • 1
  • 1
Xan
  • 74,770
  • 16
  • 179
  • 206
  • If i register for an API key I must put it in the extension script? Won't it be dangerous? – Nucktrooper May 14 '16 at 15:33
  • 1
    It will be moderately dangerous, but the worst that can happen is your extension stops working (there is no billing automatically associated). There is no way to secure the API key in an extension, unfortunately. – Xan May 14 '16 at 15:34