Last active
July 26, 2020 10:22
-
-
Save cmplstofB/dfa48f8b3106797ff36d48eaa6f63893 to your computer and use it in GitHub Desktop.
YouTubeのJSON形式の字幕を一行一文の平文に変換する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jq '.events[].segs[].utf8' | | |
sed -e 's/^"//;s/"$//;s/\. /.\ | |
/g' | | |
sed -e ':a | |
/[。!?.!?]$/ b | |
$ b | |
N;s/\n/ /;b a' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
YouTubeの字幕形式についての公式文書: サポートされる字幕ファイル
恐らく,JSON形式は独自仕様。
YouTubeの字幕をJSON形式で入手するには,
から取得すればよい。