stefansundin / rssbox

:newspaper: I consume the world via RSS feeds, and this is my attempt to keep it that way.
https://github.com/stefansundin/rssbox/discussions/64
GNU Affero General Public License v3.0
762 stars 73 forks source link

Can I only receive YouTube livestream notifications? #44

Closed eyoungmin closed 1 year ago

eyoungmin commented 3 years ago

I want to receive only real-time online performances.

stefansundin commented 3 years ago

I have had troubles finding a reliable way to fetch live streams from the YouTube API. Recently I have started using the RSS feed endpoint to get live streams. However, only one endpoint uses it and it's for an experiment I am running and there is no way to discover it without reading the source code. This endpoint can not be used as an RSS feed.

https://github.com/stefansundin/rssbox/blob/8f02186afa7c38d7d62dce41f12fcea01be1aa2b/app.rb#L270-L274

For the normal endpoint you can add ?eventType=live, but it may not be super reliable for the reasons stated above. Example: https://rssbox.herokuapp.com/youtube/UCupvZG-5ko_eiXAupbDfxWw/CNN?eventType=live

sn-o-w commented 1 year ago

I have had troubles finding a reliable way to fetch live streams from the YouTube API. Recently I have started using the RSS feed endpoint to get live streams. However, only one endpoint uses it and it's for an experiment I am running and there is no way to discover it without reading the source code. This endpoint can not be used as an RSS feed.

https://github.com/stefansundin/rssbox/blob/8f02186afa7c38d7d62dce41f12fcea01be1aa2b/app.rb#L270-L274

For the normal endpoint you can add ?eventType=live, but it may not be super reliable for the reasons stated above. Example: https://rssbox.herokuapp.com/youtube/UCupvZG-5ko_eiXAupbDfxWw/CNN?eventType=live

Unfortunately, this no longer works. No live stream is listed that should be listed, regardless of whether eventType=live is set or not. 😞

Perhaps Google made some changes to their YouTube API. 🤔

sn-o-w commented 1 year ago

@stefansundin Do you still support this endpoint? Because as it is now, seems to no longer function properly, see my previous comment.

stefansundin commented 1 year ago

RSS Box is simply a pass through to what the YouTube API provides. I can't really change anything. Maybe you should find out how to query the YouTube API in a way that it gives you the data that you want, and then make whatever appropriate changes to RSS Box so that it queries it in that way?

As I wrote in my earlier comment, I don't know why the YouTube API is so inconsistent with regards to live streams. If anyone has the answer then please enlighten me and everyone else here.

P.S. It would be more helpful if you also provided an example. "seems to no longer function properly" is not very helpful. Maybe give us an example of a YouTube channel, what data you expect to see, and what you actually get?

sn-o-w commented 1 year ago

Btw, sometimes I get the following error on page when I try the experimental endpoint: Sorry, a nasty error occurred: undefined method `>' for nil:NilClass

It would be nice if you could revive the experimental endpoint for YT live streams. 😊

stefansundin commented 1 year ago

@sn-o-w Can you share a URL that sometimes produces that error? Thanks!

sn-o-w commented 1 year ago

@stefansundin Hmmm, looks like the error disappears after a while, I mean with YT channels that are no longer new to the instance of RSSBox. Not 100% sure exactly.

For example here still appears, most likely will disappear after a while: https://rssbox.up.railway.app/youtube/UCxi19O9ACWp3JSa-topNjPA/Str3sU?eventType=live Sorry, a nasty error occurred: undefined method `>' for nil:NilClass


https://rssbox.herokuapp.com/youtube/UCxi19O9ACWp3JSa-topNjPA/Str3sU?eventType=live Interestingly, on your instance it just shows: An unhandled lowlevel error occurred. The application logs may have details.


By the way, I also tried to add @ in the URLs, like @Str3sU because handles have @, no difference at all.


That Str3sU channel is livestreaming right now.

sn-o-w commented 1 year ago

@stefansundin Another example, another YT channel:

https://rssbox.herokuapp.com/youtube/UCwUfX87V6RsbVVRrcrxmJAA/CreativeMonkeyzArmy?eventType=live

https://rssbox.up.railway.app/youtube/UCwUfX87V6RsbVVRrcrxmJAA/CreativeMonkeyzArmy?eventType=live

CreativeMonkeyzArmy just started a few mins ago, they usually stream for 3-4 hours, so you can experiment with different things.

Even if the error will disappear, looks like the live streams won't appear in your experimental endpoint. At least this is what I saw from my own testing.

stefansundin commented 1 year ago

@sn-o-w Thanks. I had actually seen this error before but I didn't have time to look into it properly. Here's the fix: eca3286ad74a9a038b152fa0fa0ba0de55da5d08

sn-o-w commented 1 year ago

It looks like now it works?! ❤️

https://rssbox.up.railway.app/youtube/UCwUfX87V6RsbVVRrcrxmJAA/CreativeMonkeyzArmy?eventType=live

Just updated my instance and now I can see the live stream entry showing up. 😍

sn-o-w commented 1 year ago

@stefansundin Thank you, sir. 😊

stefansundin commented 1 year ago

Awesome, glad it worked. 👍

stefansundin commented 1 year ago

Found a tiny bug with my previous fix. 0ceb465f4729354f882945cb317a7835913e9b9b