Share a youtube video to Termux and download its subtitles.
This bash script installs a termux-url-opener that downloads subtitles of the youtube video shared to it using youtube-dl. I wanted a somewhat easy way to view Chinese subtitles in Pleco.
- Install Termux.
- Download the script form this repo (after verifying it doesn't do bad things of course):
curl https://raw.githubusercontent.com/tynp/termux-youtube-subtitles/master/youtubedl_androidsetup.sh > install.sh
- Run it:
chmod +x ./install.sh && ./install.sh
- Share a youtube URL to Termux.
- View the subtitles found in the list and type in the desired one. If the video contains both automatic captions and manual subs, the script will prompt for which source to use.
youtube-dl
will download the subtitle to/storage/emulated/0/Youtube-DL
.- Use the subtitle file.
For Pleco, select the File Reader and Open New File. Browse to the Youtube-DL
directory (/storage/emulated/0/Youtube-DL
). Select the subtitle file. I suggest performing a sed -i '/-->/d' /storage/emulated/0/Youtube-DL/${FILE}
in Termux to remove the timestamp metadata.