Skip to content

Instantly share code, notes, and snippets.

@alexhornbake
Created April 21, 2014 19:54
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 alexhornbake/4277348f8b3ab5f7a917 to your computer and use it in GitHub Desktop.
Save alexhornbake/4277348f8b3ab5f7a917 to your computer and use it in GitHub Desktop.
fetch m3u8... follow redirect and fetch segments from akamai
m3u8Url=$1
masterM3u8=$(curl -L "$m3u8Url" | grep -m1 http)
token=$(echo \""$m3u8Url" | grep -o hdnea.*)
echo $token
echo "fetching... ""$masterM3u8""&""$token"
segments=$(curl -c cookies.txt "$masterM3u8""&""$token" | grep http)
i=0
while read -r line; do
echo "fetching... ""$line"
curl -b cookies.txt "$line" > temp_file"$i".ts
i=$((i+1))
done <<< "$segments"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment