2

Good day everyone,

For context purpose, I am trying to monitor a Youtube Channel where, whenever they post a new video, I will get a notification and process the entry.

What I have done:- a) setup the callback url to receive and reply the hub challenge.

b) https://pubsubhubbub.appspot.com/subscribe Subscribe to this site as suggested by Youtube where the topic URL is https://www.youtube.com/feeds/videos.xml?channel_id=UClrEYreVkBee7ZQYei_6Jqg (atom-feed) and the callback URL is to a Google Cloud functions url.

verification c) Reply and verified the hub challenge sent by (b).

The questions I have are:

  1. I havent receive any response from pubsubhubbub since the subscription but the Youtube channel already has updated videos since then. Have I missed some steps here or is this not the expectation to have?

  2. I expect to only receive a notification and not the XML feed body from pubsubhubbub and upon notification, I should then process and fetch the XML feed from the channel.

OR

I expect to receive the XML feed body / latest entry from pubsubhubbub.

The reason I am asking this is I see there is a latest entry latest entry and not the full feed in the pubsubhubbub site.

Thanks in advance if there are anybody who could help answer these questions.

1 Answers1

-2
import express from 'express';
import dotenv from "dotenv";
dotenv.config();

const YouTubeNotifier = require('youtube-notification');
const app = express();
const port = 6050;
const baseUrl = "https://evil-wasp-10.loca.lt"
let channelId = process.env.CHANNEL_ID;

export const notifier = new YouTubeNotifier({
    hubCallback: `${baseUrl}/youtube/notifications`,
});

app.use("/youtube/notifications", notifier.listener());

app.listen(port, () => {
    console.log(`App listening at http://localhost:${port}`)

})

notifier.subscribe(channelId);

notifier.on('subscribe', (data: any) => {
    console.log('Subscribed');
    console.log(data);
});

notifier.on('notified', (data: any) => {
    console.log('New Video');
    console.log(data);
});

  • 1
    Please [edit] and add an explanation about what and how this code of yours solves the question. See https://stackoverflow.com/help/how-to-answer – Marco Aurelio Fernandez Reyes Feb 28 '22 at 19:33
  • Good day, thanks for trying to answer but the problem I have is not the express/server/coding part. Perhaps I am not clear enough, but the problem I have is the https://pubsubhubbub.appspot.com/subscribe part where it is not triggering a notification whenever there is an update. – Jiu Wu Lancelot Mar 02 '22 at 03:06