Skip to content

Instantly share code, notes, and snippets.

@tanuj101
Created March 8, 2020 06:55
Show Gist options
  • Save tanuj101/e4411d718cd1b9e2df34ddf90f3e0a72 to your computer and use it in GitHub Desktop.
Save tanuj101/e4411d718cd1b9e2df34ddf90f3e0a72 to your computer and use it in GitHub Desktop.
Script to download a video stream
#!/usr/bin/bash
mkdir -p /tmp/gfg
rm -rf /tmp/gfg/*
for ((i=1;i<5;i++));
do
seg_num=$(printf %04d $i)
curl "https://cdnvideos.geeksforgeeks.org/courses/c9640d9f44fec028c51edd88c2d7acf6gfg-L8-hlsx480p/00000/c9640d9f44fec028c51edd88c2d7acf6gfg-L8-hlsx480p-seg_0$seg_num.ts" -H 'Referer: https://practice.geeksforgeeks.org/tracks/SPC-Hashing/?batchId=140' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' -H 'Sec-Fetch-Dest: empty --compressed' --output /tmp/gfg/$seg_num.ts
done
cat /tmp/gfg/* > video.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment