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(Format): Extract correct audio language from captions #553

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

absidue
Copy link
Collaborator

@absidue absidue commented Dec 6, 2023

Turns out the properties I was using before, are influenced by the language you request the page in and have nothing to do with the language of the audio. Instead we need to check the language of the auto-generated captions track, because that is generated in the language of the audio, yt-dlp does the same.

The video provided in #488 can be used to demonstrate the issue with the code below. It previously printed en but will correctly print ru, with this change. The video in question is in Russian, but because it has an English caption track and we requested the page in English, YouTube makes the English caption track the default.

import { Innertube } from './dist/src/platform/node.js';

const session = await Innertube.create({ lang: 'en' })
const info = await session.getBasicInfo('ID7VkY6cMRQ')

console.log(info.streaming_data.formats[0].language)

This fixes bugs in these pull requests #470 and #445.

@LuanRT LuanRT merged commit 5c83e99 into LuanRT:main Dec 7, 2023
4 checks passed
@absidue absidue deleted the fix-lang-from-captions branch December 7, 2023 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants