Skip to content

Conversation

@MitchelPaulin
Copy link
Contributor

@MitchelPaulin MitchelPaulin commented Dec 16, 2023

Add invidious fallback for likes

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Description

youtubei.js is just not returning video likes for me, this however is not treated as an error, so I was just getting likes of 0. Invidious however was giving me video likes. I added a fallback where if the likes are not found I ask Invidious for them. I also moved the fetch likes code to the bottom of the try/catch in case something else above throws, since this would also fetch likes from invidious, so it avoids having to make two fetches.

I also removed any reference to youtube dislikes form the file since its no longer relevant

Desktop

  • **OS: POP_OS 22.04
  • FreeTube version: 0.19.1"

Additional context

Is anyone else having issues with the likes not loading on any videos? Maybe youtube is trying to block likes for people that are not logged in? I've attempted to update youtubei and tried with/without my VPN and its always undefined. If this is just a me issue it might not be worth merging.

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 16, 2023 21:24
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 16, 2023
@kommunarr
Copy link
Collaborator

kommunarr commented Dec 16, 2023

Thanks for looking into this & writing something up!

suggestion (blocking): Check this.backendPreference === 'local' && this.backendFallback is true before trying to load data from Invidious.

question: Does this ever happen the other way around, where we would need to add the corresponding Local API fallback logic if Invidious fails? Or is this a weird bug specific to the Local API? If it is a weird bug with the Local API, is this bandaid really getting at the problem?

I feel like I might have been seeing this recently as well, although I can't exactly remember. If anyone can replicate this occurring and/or show this fallback in action (with non-mocked data), that would be nice for testing it.

@absidue
Copy link
Member

absidue commented Dec 16, 2023

I would rather have my YouTube.js pull request merged that parses YouTube's new layout, as that's the proper fix and how we usually fix the local API, instead of adding an extra request to Invidious for every single video that you watch.

@MitchelPaulin
Copy link
Contributor Author

I would rather have my YouTube.js pull request merged that parses YouTube's new layout, as that's the proper fix and how we usually fix the local API, instead of adding an extra request to Invidious for every single video that you watch.

That would be preferable for sure.

Could you link it? I was taking a look at youtubei.js and couldn't see any open issue or PR addressing this, unless youtube.js is something else

@MitchelPaulin
Copy link
Contributor Author

Oh it's a PR for freetube not to youtbei.js https://github.com/FreeTubeApp/FreeTube/pull/4370/files. I guess this is fixed in 8.0.0.

I guess my only question then is error handling. In the case we can't find something like likes, should that throw and fall into the invidious logic? Seems like that would be better rather than having missing info like it currently does

@absidue
Copy link
Member

absidue commented Dec 17, 2023

I would rather have my YouTube.js pull request merged that parses YouTube's new layout, as that's the proper fix and how we usually fix the local API, instead of adding an extra request to Invidious for every single video that you watch.

That would be preferable for sure.

Could you link it? I was taking a look at youtubei.js and couldn't see any open issue or PR addressing this, unless youtube.js is something else

I'm sorry for not linking it, I assumed that the name of it made it rather obvious.
LuanRT/YouTube.js#557

auto-merge was automatically disabled December 17, 2023 00:40

Pull request was closed

@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants