No description
Find a file
2026-01-19 00:03:39 +01:00
downloadv2.sh Update downloadv2.sh 2026-01-18 23:56:08 +01:00
readme.md Update readme.md 2026-01-18 23:20:42 +01:00
report_rai_3_dl.sh Update report_rai_3_dl.sh 2026-01-19 00:03:39 +01:00

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 content
  • curl - for fetching JSON files
  • bash - shell environment

Installation

  1. Download the script:

    chmod +x download_script.sh
    
  2. 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:

  • s for seconds (e.g., 30s)
  • m for minutes (e.g., 1m, 5m)
  • h for 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

  1. Downloads the content from the specified URL using yt-dlp
  2. Saves it with the provided name in the specified path
  3. Waits for the specified delay (if provided)
  4. Converts the URL from .html to .json (e.g., video.htmlvideo.json)
  5. Downloads the JSON file using curl
  6. Saves the JSON with the same name plus .json extension

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 .html with .json
  • The path must exist before running the script
  • Perfect for downloading to mounted USB drives or network shares