Skip to content

Instantly share code, notes, and snippets.

@tanuj101
tanuj101 / download
Created March 8, 2020 06:55
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