Subscribe to Push Notifications

The YouTube Data API (v3) supports push notifications via PubSubHubbub, a server-to-server publish/subscribe protocol for Web-accessible resources. Notifications are pushed out to subscribers via HTTP webhooks, which is much more efficient than polling-based solutions. With PubSubHubbub, your server finds out about events in near real-time, without having to determine the optimal polling interval or repeatedly fetching data that hasn’t changed.

Your PubSubHubbub callback server receives Atom feed notifications when a channel does any of the following activities:

uploads a video

updates a video's title

updates a video's description

The following steps explain how to subscribe to notifications:

Set up a callback server that can handle incoming Atom feed notifications.

Set the mode to subscribe. (Or set the mode to unsubscribe to cancel a subscription.)

Set the callback URL to the URL that you set up in step 1.

Set the topic URL to https://www.youtube.com/xml/feeds/videos.xml?channel_id=CHANNEL_ID, where CHANNEL_ID is the YouTube channel ID for which you want to retrieve push notifications.

Process notifications sent to your callback server. The notification format is shown below. Note that you can use the <yt:videoId> element's value to identify the newly added or updated video. You can also use the <yt:channelId> element's value to identify the channel that owns that video.