Yotter icon indicating copy to clipboard operation
Yotter copied to clipboard

Support for PubSubHubbub (PubSub)

Open FireMasterK opened this issue 4 years ago • 3 comments

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

FireMasterK avatar Oct 28 '20 17:10 FireMasterK

Doesn't this need an API key?

pluja avatar Oct 28 '20 18:10 pluja

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

FireMasterK avatar Oct 28 '20 18:10 FireMasterK

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>

FireMasterK avatar Nov 06 '20 08:11 FireMasterK