Is it possible to obtain the spoken language from youtube-dl?

会有一股神秘感。 提交于 2021-02-10 19:10:54

问题


I'm using youtube-dl to download videos from youtube that we query using words from a target foreign language, but there's no guarantee that the video is in the target language. Is there any way to know what is the spoken language in a video when using youtube-dl? I figure youtube must know this info since it generates captions for some videos. Thanks!


回答1:


I am not sure if you can use youtube-dl to get the video language, but if you use the Youtube Data API it is possible.

The documentation here shows that you can get the video language in multiple ways:

  • Video title / description language: snippet.defaultLanguage
  • spoken language in default audio track: snippet.defaultAudioLanguage

The option for you would be to call the Youtube Data API and check if snippet.defaultAudioLanguage matches your desired language.



来源:https://stackoverflow.com/questions/47105402/is-it-possible-to-obtain-the-spoken-language-from-youtube-dl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!