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 playlist item fetching for local API #4102

Conversation

PikachuEXE
Copy link
Collaborator

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

Closes #4068 #4086

Description

YT now sometimes returns useless continuation data which makes loading "next page" sometimes failed with error from youtube.js
We need to handle it somehow

Screenshots

Lazy

Testing

Example playlists/video with playlists to test

Watch video page, playlist component loading (normal)

Watch video page, playlist component loading (playlist cached)

Playlist view

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 5, 2023 06:38
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Oct 5, 2023
@PikachuEXE
Copy link
Collaborator Author

@absidue
Copy link
Member

absidue commented Oct 5, 2023

I'm curious why you decided to go with a callback instead of just returning all the results?

@PikachuEXE
Copy link
Collaborator Author

@absidue
Copy link
Member

absidue commented Oct 6, 2023

Mainly curious why you decided to use a callback, instead of collecting it in an array and returning it all in one go?

videos.push(...parsedVideos)
}
const videos = []
await untilEndOfLocalPlayList(playlist, (p) => {
Copy link
Member

Choose a reason for hiding this comment

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

Using promises and callbacks together is a weird code pattern, which I'm not a fan of (the whole point of async/await in javascript was to get away from callbacks), but as we are in a rush and the code works, i'll accept it this time.

@FreeTubeBot FreeTubeBot merged commit 5c8d49b into FreeTubeApp:development Oct 7, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Oct 7, 2023
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Oct 8, 2023
* development:
  ! Fix playlist item fetching for local API (FreeTubeApp#4102)
  ! Fix watch page video published time parsing (FreeTubeApp#4105)
  Translated using Weblate (Serbian)
  Bump youtubei.js from 6.4.0 to 6.4.1 (FreeTubeApp#4090)
  Bump rimraf from 5.0.1 to 5.0.5 (FreeTubeApp#4091)
  Bump the stylelint group with 2 updates (FreeTubeApp#4088)
  Bump electron from 22.3.24 to 22.3.25 (FreeTubeApp#4089)
  Translated using Weblate (Bulgarian)
  Update FT history import to accept key lastViewedPlaylistId (FreeTubeApp#4038)
  Translated using Weblate (Dutch)
  Translated using Weblate (Lithuanian)
  Translated using Weblate (Japanese)
  Translated using Weblate (Croatian)
  Translated using Weblate (Estonian)
  Translated using Weblate (Croatian)

# Conflicts:
#	src/renderer/components/data-settings/data-settings.js
#	src/renderer/components/ft-list-video/ft-list-video.js
#	src/renderer/components/watch-video-info/watch-video-info.js
#	src/renderer/views/Playlist/Playlist.js
#	src/renderer/views/Watch/Watch.js
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Oct 8, 2023
* feature/playlist-2023-05: (176 commits)
  ! Fix playlist item fetching for local API (FreeTubeApp#4102)
  ! Fix watch page video published time parsing (FreeTubeApp#4105)
  Translated using Weblate (Serbian)
  Bump youtubei.js from 6.4.0 to 6.4.1 (FreeTubeApp#4090)
  Bump rimraf from 5.0.1 to 5.0.5 (FreeTubeApp#4091)
  Bump the stylelint group with 2 updates (FreeTubeApp#4088)
  Bump electron from 22.3.24 to 22.3.25 (FreeTubeApp#4089)
  Translated using Weblate (Bulgarian)
  Update FT history import to accept key lastViewedPlaylistId (FreeTubeApp#4038)
  ! Fix ft-video having different URLs in links
  Translated using Weblate (Dutch)
  Translated using Weblate (Lithuanian)
  Translated using Weblate (Japanese)
  Translated using Weblate (Croatian)
  Translated using Weblate (Estonian)
  Translated using Weblate (Croatian)
  ! Fix external player handling for video in local playlist
  Translated using Weblate (Finnish)
  Mobile/tablet channel page & share button visual improvements (FreeTubeApp#4061)
  Support multiple audio tracks and AV1 for Invidious by using the local API DASH manifest generator (FreeTubeApp#3942)
  ...
@PikachuEXE PikachuEXE deleted the fix/playlist-empty-continuation-response branch November 4, 2023 03:05
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.

[Bug]: Playlists randomly pausing
5 participants