Skip to content

Instantly share code, notes, and snippets.

@ishan123456789
Last active July 4, 2020 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishan123456789/e2f10b73e7c779ec68c5b713b51b9273 to your computer and use it in GitHub Desktop.
Save ishan123456789/e2f10b73e7c779ec68c5b713b51b9273 to your computer and use it in GitHub Desktop.
This script helps to download any m3eu8 file to the user's local system
#!/usr/bin/env bash
# This script downloads a m3eu8 file to your local system
# Make sure ffmpeg command works in your terminal directly
# ./ffmpeg_m3eu8.sh https://VALID_SITE.m3u8 RANDOME_NAME_FOR_YOUR_FILE
URL_TO_FETCH=$1
FILE_INITIAL=$2
# Checking if VALID ARGUMENTS PROVIDED
[[ -z "$URL_TO_FETCH" ]] && { echo "Error: URL not provided"; exit 1; }
[[ -z "$FILE_INITIAL" ]] && { echo "Error: FILE NAME not provided"; exit 1; }
# Start the process
echo "Fetching URL $URL_TO_FETCH"
ffmpeg -i "$URL_TO_FETCH" -codec copy "$FILE_INITIAL.mp4"
# Move the file from here to the document folder
mv $_ /Users/ishanmahajan/Documents/
open /Users/ishanmahajan/Documents/
say -v Alex "We're all done you the file is ready to be played\!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment