No description
| downloadv2.sh | ||
| readme.md | ||
| report_rai_3_dl.sh | ||
Report Rai 3 Downloader
A bash script to download content using yt-dlp and fetch associated JSON metadata with optional delay.
Requirements
yt-dlp- for downloading contentcurl- for fetching JSON filesbash- shell environment
Installation
-
Download the script:
chmod +x download_script.sh -
Ensure dependencies are installed:
# Install yt-dlp pip install yt-dlp # curl is usually pre-installed on most systems
Usage
./download_script.sh -u <url> -n <name> -p <path> [-d <delay>]
Parameters
-u <url>- Required. The URL to download (must end with .html)-n <name>- Required. The name for the output file-p <path>- Required. The directory path where files will be saved (e.g., /mnt/usb)-d <delay>- Optional. Delay before downloading JSON file (default: 0s)
Delay Format
The delay parameter accepts:
sfor seconds (e.g.,30s)mfor minutes (e.g.,1m,5m)hfor hours (e.g.,2h)
Examples
Basic usage (no delay)
./download_script.sh -u "https://example.com/video.html" -n "my_video" -p "/mnt/usb"
With 30 seconds delay
./download_script.sh -u "https://example.com/video.html" -n "my_video" -p "/mnt/usb" -d 30s
With 1 minute delay
./download_script.sh -u "https://example.com/video.html" -n "my_video" -p "/mnt/usb" -d 1m
With 2 hours delay
./download_script.sh -u "https://example.com/video.html" -n "my_video" -p "/mnt/usb" -d 2h
Flags in different order
./download_script.sh -p "/home/user/downloads" -d 1m -n "video" -u "https://example.com/content.html"
How It Works
- Downloads the content from the specified URL using
yt-dlp - Saves it with the provided name in the specified path
- Waits for the specified delay (if provided)
- Converts the URL from
.htmlto.json(e.g.,video.html→video.json) - Downloads the JSON file using
curl - Saves the JSON with the same name plus
.jsonextension
Output
The script creates two files in the specified path:
<name>- The downloaded content<name>.json- The associated JSON metadata
Error Handling
- The script validates that all required parameters are provided
- Checks if the specified path exists before downloading
- Displays clear error messages if something goes wrong
Notes
- The script assumes the JSON endpoint follows the pattern: replacing
.htmlwith.json - The path must exist before running the script
- Perfect for downloading to mounted USB drives or network shares