Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add TV client endpoints and nodes to get content with default OAuth2 Login #872

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

Duell10111
Copy link
Contributor

As reaction to the block of the classic TV OAuth authentication on non TV endpoints, I tried to add Helper classes with TV Client optimization.
Related issue: #803
As I am not an expert of the Innertube API and the Youtube.js library, feel free to optimize or bring up suggestions of this PR.
Therefore this PR is created as draft. :)

Additionally regarding TV endpoints, I added a new function to adapt watched time for videos added to the watch list (history). (Issue: #825)

Further for the TV client I added a helper function to get the continuation of HorizontalList as needed for the TV Homefeed. :)

@Duell10111
Copy link
Contributor Author

Regarding the failing test, locally it works. ;)

Copy link
Collaborator

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is absolutely massive, it would definitely be a lot more sensible to split it out into multiple smaller ones, especially because it contains some changes that have nothing to do with the TV nodes like the watch history stuff.

Here are a list of things that definitely need to change before it could be considered mergable (not sure it if should be considering that it adds lots of nodes and bloat that many users of the library probably won't even need) but it definitely should be split up into multiple pull requests.

package.json Outdated Show resolved Hide resolved
Comment on lines 1 to 2
import { HorizontalListContinuation, type IBrowseResponse } from '../../parser/index.js';
import { Parser } from '../../parser/index.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please deduplicate these imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here.

Maybe to make this a requirement, we could add the no duplicate imports rule to the eslint config to show errors if this happens?
https://eslint.org/docs/latest/rules/no-duplicate-imports

Comment on lines +16 to +17
#session: Session;
readonly #actions: Actions;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are saving the session and the actions instances in their on variables but then in various places you still access the actions instance through this#session.actions. Could you please pick one and use it consistently throughout the class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced to use #action property.

src/parser/classes/AutonavEndpoint.ts Outdated Show resolved Hide resolved
src/core/mixins/MediaInfo.ts Outdated Show resolved Hide resolved
src/parser/classes/EntityMetadata.ts Outdated Show resolved Hide resolved
src/parser/classes/MacroMarkersListView.ts Outdated Show resolved Hide resolved
src/parser/classes/MacroMarkersListView.ts Outdated Show resolved Hide resolved
src/parser/classes/ReloadContinuationData.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert unrelated changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sourceMaps got removed some major version before, was there a specific reason for that you know?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still use them, but only locally. They were bloating the NPM package, so I decided to just disable them.

@absidue
Copy link
Collaborator

absidue commented Jan 15, 2025

Additionally please change the commit messages to say feat instead of chore, release please looks at the commit messages so if this were to be merged, then it would get logged as a chore and not a feature implementation.

/**
* Retrieves the user's My YouTube page.
*/
async getMyYoutubeFeed(): Promise<MyYoutubeFeed> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the library? If yes, maybe we should just name it getLibrary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemed to be an extra browseId "FEmy_youtube", which differed from the normal Library as it contained a left tab bar with a grid on the right, based on the tab selection.

@Duell10111
Copy link
Contributor Author

Thanks @absidue @LuanRT for all the suggestions I can split the PR into multiple and do the other changes as mentioned.
I am a bit unsure when I can do this, because I have not much time until next week.
But I will do this once I got time. :)

@LuanRT
Copy link
Owner

LuanRT commented Jan 29, 2025

@Duell10111 This PR is quite large, so I'll be helping you with it very soon. I'm also interested in getting OAuth working again, but we may need to make improvements in a few places.

@Duell10111
Copy link
Contributor Author

@Duell10111 This PR is quite large, so I'll be helping you with it very soon. I'm also interested in getting OAuth working again, but we may need to make improvements in a few places.

Thank you, I would be glad to get help.
Feel free to optimize or adapt it as you think. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants