Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Support for PubSubHubbub (PubSub) #126

Open
FireMasterK opened this issue Oct 28, 2020 · 3 comments
Open

Support for PubSubHubbub (PubSub) #126

FireMasterK opened this issue Oct 28, 2020 · 3 comments
Labels
efficiency Efficiency improvement youtube Youtube-related issue
Milestone

Comments

@FireMasterK
Copy link
Member

This way, we don't need to use RSS to fetch feeds (and hence avoiding the 6-7 second load time when loading feeds).

The only drawback is that private instances can't use this due to them being unable to receive webhooks.

I believe this will also reduce our chance of getting rate limited significantly (due to the much fewer requests needer).

https://developers.google.com/youtube/v3/guides/push_notifications

Example Implementation in Invidious:
Subscription: https://github.com/iv-org/invidious/blob/074497b0f66b055b663015e3ed4d674d24b5b9cd/src/invidious/helpers/utils.cr#L338-L364
Webhook: https://github.com/iv-org/invidious/blob/aa2ae37365a4d752b0e8de5aa243a58568e5ed71/src/invidious.cr#L3224-L3335

@pluja
Copy link
Member

pluja commented Oct 28, 2020

Doesn't this need an API key?

@FireMasterK
Copy link
Member Author

The surprising thing is that it doesn't! The key referenced in the Invidious code is actually the HMAC key.

@FireMasterK
Copy link
Member Author

Here's a real example, if you need it:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns:yt="http://www.youtube.com/xml/schemas/2015" xmlns="http://www.w3.org/2005/Atom"><link rel="hub" href="https://pubsubhubbub.appspot.com"/><link rel="self" href="https://www.youtube.com/xml/feeds/videos.xml?channel_id=UCt4t-jeY85JegMlZ-E5UWtA"/><title>YouTube video feed</title><updated>2020-11-06T08:13:10.038244647+00:00</updated><entry>
  <id>yt:video:U2rExfq365Y</id>
  <yt:videoId>U2rExfq365Y</yt:videoId>
  <yt:channelId>UCt4t-jeY85JegMlZ-E5UWtA</yt:channelId>
  <title>Bihar Election 2020: बीच बहस के दौरान Nitish Kumar के 'संन�यास' पर ये क�या बोल ग� Congress प�रवक�ता</title>
  <link rel="alternate" href="https://www.youtube.com/watch?v=U2rExfq365Y"/>
  <author>
   <name>Aaj Tak</name>
   <uri>https://www.youtube.com/channel/UCt4t-jeY85JegMlZ-E5UWtA</uri>
  </author>
  <published>2020-11-06T08:12:26+00:00</published>
  <updated>2020-11-06T08:13:10.038244647+00:00</updated>
 </entry></feed>

@pluja pluja added this to the MVP milestone Nov 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
efficiency Efficiency improvement youtube Youtube-related issue
Projects
None yet
Development

No branches or pull requests

2 participants