Skip to content

Commit

Permalink
fix: video reset
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolson committed Jul 22, 2024
1 parent 4854eeb commit 9ea8e5d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/yt-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,14 @@ const makeFeedbackPayload = (feedbackToken: string) => ({
})

async function sendFeedbackRequest(config: YTConfigData, feedbackToken: string) {
const url = `https://www.youtube.com/youtubei/v1/feedback?key=${config.INNERTUBE_API_KEY}`
const rawResponse = await fetch(url, {
method: 'POST',
headers: generateRequestHeaders(config, API_V1_REQUIRED_HEADERS),
body: JSON.stringify(makeFeedbackPayload(feedbackToken)),
})
const response = await rawResponse.json()
const youtube = await Innertube.create({
cookie: document.cookie,
fetch: (...args) => fetch(...args),
});

const result = await youtube.actions.execute('/feedback', makeFeedbackPayload(feedbackToken));
const response = result.data

if (!response.feedbackResponses[0].isProcessed) {
throw new Error('Failed to remove video from watch history')
}
Expand Down

0 comments on commit 9ea8e5d

Please sign in to comment.