Enhancement: Allow filtering livestreams from subscription page
Just like https://github.com/webosbrew/youtube-webos/pull/201 did for Shorts, I'd like to see an option to hide live video from the subscriptions list as well.
I tried my hand at implementing this by copying what @JaCzekanski did – unfortunately I couldn't identify a uniquely identifying mark for livestreams like the reelWatchEndpoint thing for shorts.
The best I could identify is the fact that for livestreams it says Streamed x hours ago instead of x hours ago. I understand using that to identify the videos is far from ideal to put it mildly – it probably doesn't work with different languages, a currently running livestream is also different… but I at least wanted to see if I could get this approach to work at all. Sadly, I couldn't, and despite trying a lot of things to debug this further I'm at my wits end.
I've looked into the JSON output for my page via the webOS simulator – I could see the reelWatchEndpoint at the expected spot based on the code for hiding Shorts, so I assume I was looking at the correct thing in general. Here's the corresponding output of two videos, a normal one and a livestream. As I said, the only discernable difference to me seems to be the Streamed prefix in one of the lineItemRenderer->text->simpleText items.
My attempts are here: https://github.com/webosbrew/youtube-webos/compare/main...manuelgrabowski:youtube-webos:filter-live-video-from-subscriptions?expand=1 – in the first commit I just copied the entire approach, only changing the callback function for container.items.filter((elm)). After tinkering with that for a while, I was wondering if the two filters might be in conflict, so as another experiment I just added my check to the existing callback function – that's the second commit.
I know that modifying the existing callback function as shown in the second commit works in general. When changing my isLive determination to a simple Math.random() < 0.5, then building the IPK and sending it to my TV, I do indeed get random videos hidden on my subscriptions page. So it must be that my condition isn't working… but it looks logically correct to me.
For debugging, I was unable to get any console.log output to show in the web inspector for the webOS simulator. I have no idea how I'd go about showing debug output directly on the TV itself, or how to use the console in the simulator to try and evaluate my expression there. :/
Great attempt. To remotely inspect TV apps, you need to clone this repo and run npm install in the terminal in the same directory. Then npx ares-inspect -a youtube.leanback.v4 also in the same directory. If you've never used the webOS CLI tools before to work directly with your TV, you'll need to run npx ares-setup-device first and follow the prompts.