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

local API: Work around YouTube sending empty watch next responses #4626

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,24 @@ export default defineComponent({

this.isFamilyFriendly = result.basic_info.is_family_safe

if (result.watch_next_feed) {
try {
// work-around YouTube occasionally sending a watch next feed that only contains a continuation
if (result.watch_next_feed.length === 0 && result.wn_has_continuation) {
await result.getWatchNextContinuation()
}

this.recommendedVideos = result.watch_next_feed
?.filter((item) => item.type === 'CompactVideo' || item.type === 'CompactMovie')
.map(parseLocalWatchNextVideo) ?? []
} catch (error) {
console.error('Failed to fetch the watch next feed', error)
this.recommendedVideos = []
}
} else {
this.recommendedVideos = []
}

const recommendedVideos = result.watch_next_feed
?.filter((item) => item.type === 'CompactVideo' || item.type === 'CompactMovie')
.map(parseLocalWatchNextVideo) ?? []
Expand Down
Loading