To download a video from a given link using yt-dlp in Termux and save it to the "Download" section on your Android device, you can follow these steps. First, ensure you have yt-dlp installed in Termux. If not, you can install it using the following command:
pkg install yt-dlp
After installing yt-dlp, you can use the following command to download a video. Replace https://example.com/video_url with the actual URL of the video you want to download.
yt-dlp -o "/storage/emulated/0/Download/%(title)s.%(ext)s" https://example.com/video_url
Here's a breakdown of the command:
yt-dlp: The command to invoke the yt-dlp tool.
-o: Specifies the output template, i.e., where and how the downloaded file will be named.
"/storage/emulated/0/Download/%(title)s.%(ext)s": This is the output template.
/storage/emulated/0/Download/: This is the path to the "Download" folder on most Android devices. It assumes that your Termux has access to this directory. You might need to grant storage permissions to Termux if you haven't already.
%(title)s.%(ext)s: This will name the file with the title of the video and its original extension.
https://example.com/video_url: Replace this with the URL of the video you want to download.
Before running the command, ensure that Termux has the necessary permissions to write to the "Download" directory. You can grant the storage permission by running:
termux-setup-storage
And then accepting the permission request.
If the video is available in different qualities, you can specify the quality or format you prefer by using additional options with yt-dlp, such as -f for specifying the format. For example:
yt-dlp -f "best[height<=1080]" -o "/storage/emulated/0/Download/%(title)s.%(ext)s" https://example.com/video_url
This command will download the video in the best quality available that is not higher than 1080p.
Check the yt-dlp documentation or help (yt-dlp --help) for more options and customization.