前提条件
非常抱歉,这个程序就是个雏形,非常不完善,输入需要手动编辑,凑活着可以用,请自己完善吧。
开源声明:此文代码引用了一个开源MIT License的Python库,其他代码是本人自写自用。你可以随便用,但是本人不负责有关代码的任何责任。
概述
输入:油管英文视频的视频号 例如 “04j_yB4CZPM”
输出:两个srt文件
- 手动英文(没有则是自动英文)srt 字幕,即eng.srt
- 自动中文简体翻译srt字幕,即zh.srt
核心开源库 (开源的MIT License授权,不存在版权问题,请审核放行!!!)
核心思想是用到了开源的MIT License的 youtube_transcript_api 这个库来为我们服务。其中,用了YouTubeTranscriptApi, 用于获取字幕。
也用到了 其中 formatters 子库里面的 SRTFormatter,用于将字幕转化为srt格式。
https://github.com/jdepoix/youtube-transcript-api
如果你引用 youtube_transcript_api ,请在代码中 增加一个 MIT License 声明文件 MIT_LICENSE.TXT
(来源:https://opensource.org/license/MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINF