LuanRT / YouTube.js

A wrapper around YouTube's internal API — reverse engineering InnerTube
https://www.npmjs.com/package/youtubei.js
MIT License
3.48k stars 219 forks source link

Type mismatch, got TranscriptSectionHeader expected TranscriptSegment. #514

Closed tsvetan-nikolov closed 11 months ago

tsvetan-nikolov commented 11 months ago

Steps to reproduce

const id = 'y9K6PVWGBEM'; const youtube = await Innertube.create({ retrieve_player: false, enable_safety_mode: true, });

const transcript = await youtube.getTranscript(id);

Failure Logs

ParsingError: Type mismatch, got TranscriptSectionHeader expected TranscriptSegment.
    at ERROR_HANDLER (.../node_modules/youtubei.js/dist/src/parser/parser.js:52:26)
    at parseItem (.../node_modules/youtubei.js/dist/src/parser/parser.js:337:21)
    at Module.parseArray (.../node_modules/youtubei.js/dist/src/parser/parser.js:366:28)
    at new TranscriptSegmentList (.../node_modules/youtubei.js/dist/src/parser/classes/TranscriptSegmentList.js:8:40)  
    at Module.parseItem (.../node_modules/youtubei.js/dist/src/parser/parser.js:346:28)
    at new TranscriptSearchPanel (.../node_modules/youtubei.js/dist/src/parser/classes/TranscriptSearchPanel.js:10:28) 
    at Module.parseItem (.../node_modules/youtubei.js/dist/src/parser/parser.js:346:28)
    at new Transcript (.../node_modules/youtubei.js/dist/src/parser/classes/Transcript.js:7:31)
    at Module.parseItem (.../node_modules/youtubei.js/dist/src/parser/parser.js:346:28)
    at new UpdateEngagementPanelAction (.../node_modules/youtubei.js/dist/src/parser/classes/actions/UpdateEngagementPanelAction.js:8:31) {
  info: {
    startMs: '884000',
    endMs: '948000',
    snippet: { simpleText: 'Conclusion' },
    accessibility: { accessibilityData: [Object] },
    trackingParams: 'CAIQ8bsCIhMI1dj--ZfRgQMV7ONCBR3diwwq'
  },
  date: 2023-09-30T01:31:15.611Z,
  version: '6.4.0'
}

Expected behavior

I expected to not have the warning in the console.

Current behavior

The functionality works as expected. The problem is the messages in the console.

Version

Default

Anything else?

No response

Checklist

LuanRT commented 11 months ago

This has already been fixed in the main branch I believe. You can either wait until the next release or install the edge version.

Note that a few things have changed regarding that transcript feature (see the recent PRs).

LuanRT commented 11 months ago

Closing this as v6.4.1 has been released. Let me know if you have other issues.