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

refactor: clean up, fix & remove outdated code #228

Merged
merged 4 commits into from
Nov 6, 2022

Conversation

LuanRT
Copy link
Owner

@LuanRT LuanRT commented Nov 6, 2022

Description

This removes all references to legacy code from v1, including most of the utility methods from Actions and the old call method from NavigationEndpoint. This should make the library easier to maintain and less prone to bugs.

Also including a few fixes:

Support for YouTube Music's new library layout

YouTube Music recently received a layout update which caused @patrickkfkan's implementation to break, the page now consists of a simple header + contents configuration.

Usage:

// Retrieve the library 
const library = await yt.music.getLibrary();
console.log(library);

// Retrieve continuation
if (library.has_continuation) {
  const library_continuation = await library.getContinuation();
  console.log(library_continuation);
}

// Sort library content
const sorted_library = await library.applySortFilter('Recently played');
console.log(sorted_library);

// Filter library content
const filtered_library = await library.applyFilter('Albums');
console.log(filtered_library);

// Check available filters
console.log(library.sort_filters)
console.log(library.filters);

YouTube Playlists

The Innertube#getPlaylist method would usually return an invalid Playlist object and continuations could not be retrieved, this should fix that.


This is a rather huge PR, so my apologies to anyone looking around here.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@github-actions github-actions bot added the docs label Nov 6, 2022
@LuanRT LuanRT marked this pull request as ready for review November 6, 2022 06:06
@LuanRT LuanRT merged commit aa334aa into main Nov 6, 2022
@LuanRT LuanRT deleted the refactor/clean-up-code-and-fix-some-bugs branch November 6, 2022 06:32
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.

1 participant