5 ms·
If you want an CLI version of a similar idea, you can use yt-dlp and some simple jq to pull down the captions for a file: curl `\ yt-dlp -j "https://
by banana_giraffe 4y ago
If you want an CLI version of a similar idea, you can use yt-dlp and some simple jq to pull down the captions for a file:
curl `\
yt-dlp -j "https://www.youtube.com/watch?v=aeWyp2vXxqA" | \
jq -r '.automatic_captions.en[] | select(.ext=="json3") | .url'`
- ptspts 4y agoNot all YouTube videos with spoken text have automatic captions.
- arboles 4y agohttps://news.ycombinator.com/item?id=34041455 https://news.ycombinator.com/item?id=34041455
- cercatrova 4y agohttps://github.com/m1guelpf/yt-whisper https://github.com/m1guelpf/yt-whisper
- jck 4y agoI am not a fan of this pattern - if I'm understanding correctly, you would have to part with all of yt-dlp's niceties like playlist/channel handling, quality selection, file naming, logging config etc. Why not just use the whisper cli on yt-dlp CLI's output for videos with bad or no subtitles?
- cercatrova 4y agoSure you could do that too. yt-whisper uses yt-dlp underneath so there might be a way to pass arguments to the inner yt-dlp instance. Or if not you can modify the source directly, it seems to be a simple wrapper. Or again you can do what you were saying, using the Whisper CLI. All good options, I just mentioned this one since it's easier if I just want to download a video with subs.
- varenc 4y agoThat gets me the subs in some usual complicated format? It's a bit of work to extract the actual text from that. To get youtube subs in .srt format this gave me some limited success: yt-dlp --convert-subs=srt --write-auto-sub --write-sub --sub-lang "en,en-us,en-GB,automatic-caption-en" --skip-download "https://www.youtube.com/watch?v=1OfxlSG6q5Y" Behind the scenes yt-dlp is downloading the subs in .vtt format than using ffmpeg to convert those to .srt. Depending on your situation the original .vtt format might be fine.
- cercatrova 4y agoOr even better, yt-whisper, which uses OpenAI's Whisper speech to text. I guess it'd be better to first check whether the video has captions first before Whispering, so maybe both your command and this one could be used together. https://github.com/m1guelpf/yt-whisper https://github.com/m1guelpf/yt-whisper
- rpigab 4y ago... | split_sentences | grep -viE '*vpn*'
- tetris11 4y ago`| grep -viE 'skillshare'`
- MollyRealized 4y agoI apologize for the question, but I am not entirely clear where "split_sentences" is. Is it a separate script? I have been looking for something with that sort of functionality for a while, very often for this very purpose, splitting transcripts.
- rpigab 4y agoSorry for the late answer, but yes, it would have to be a separate script or command, it is purely fictional, I made it up because it made more sense for the joke to have it, and people might have pointed out that my grep would have filtered out too much context, so I had to add this. I'm sure there are many unix-y tools for this purpose, but I don't know of them. If you're looking for something that's installed everywhere, maybe a very big awk or sed regex with multiline wizardry could do the trick for most easy-to-parse latin languages and you'd just have to copypaste it around. It prolly becomes harder for regexes once you start working with right-to-left languages like Arabic, and languages with different ponctuation, so it might not be i18n-friendly. Related Stackoverflow : https://stackoverflow.com/questions/33704443/python-regexp-sentence-segmentation https://stackoverflow.com/questions/33704443/python-regexp-s...