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

Fix YouTube API requests #275

Merged
merged 4 commits into from
Jul 24, 2024
Merged

Fix YouTube API requests #275

merged 4 commits into from
Jul 24, 2024

Conversation

dnicolson
Copy link
Contributor

@dnicolson dnicolson commented Jul 22, 2024

Description

This replaces the YouTube API calls with functionality from https://github.com/LuanRT/YouTube.js.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

@avallete avallete added the safe to test Use to start running CI on the PR label Jul 22, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (0793980) to head (776bfc9).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #275   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines           52        52           
  Branches         7         7           
=========================================
  Hits            52        52           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1261110...776bfc9. Read the comment docs.

@dnicolson dnicolson changed the title Fix video removal and reset Fix YouTube API requests Jul 23, 2024
@dnicolson
Copy link
Contributor Author

Hi @avallete, if this gets merged, further optimizations like this are possible:

const youtube = await Innertube.create({
  cookie: document.cookie,
  fetch: (...args) => fetch(...args),
})

let playlist = await youtube.getPlaylist(playlistName);
let videoIds = playlist.videos.map(video => video.id);

while (playlist.has_continuation) {
  playlist = await playlist.getContinuation();
  videoIds = videoIds.concat(playlist.videos.map(video => video.id));
}

console.log(videoIds);

@avallete
Copy link
Owner

Hi @avallete, if this gets merged, further optimizations like this are possible:

const youtube = await Innertube.create({
  cookie: document.cookie,
  fetch: (...args) => fetch(...args),
})

let playlist = await youtube.getPlaylist(playlistName);
let videoIds = playlist.videos.map(video => video.id);

while (playlist.has_continuation) {
  playlist = await playlist.getContinuation();
  videoIds = videoIds.concat(playlist.videos.map(video => video.id));
}

console.log(videoIds);

Nice ! Looks good !

@avallete avallete merged commit c46835c into avallete:master Jul 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test Use to start running CI on the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants