Created
February 8, 2021 19:49
-
-
Save vinayakg/11b262ee551274f44540f57b57799564 to your computer and use it in GitHub Desktop.
download-file-with-retry.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while read line; do | |
# wait for the file to download infinitely, since we are getting 303 HTTP status | |
while [ ! -f "NDCDoc-$line.pdf" ] | |
do | |
# curl request fetched from browser | |
curl -sS -O -J "https://abc.com/admin/l/down/$line" \ | |
-H 'authority: abc.com' \ | |
-H 'upgrade-insecure-requests: 1' \ | |
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko)' \ | |
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ | |
-H 'sec-fetch-site: same-origin' \ | |
-H 'sec-fetch-mode: navigate' \ | |
-H 'sec-fetch-user: ?1' \ | |
-H 'sec-fetch-dest: document' \ | |
-H 'referer: https://abc.com/admin/l/c/123' \ | |
-H 'accept-language: en-GB,en;q=0.9,en-US;q=0.8' \ | |
-H 'cookie: ci_session=asdf; AWSALB=asda+ixoofDBP0LWqTz0Pkw28zPGlEL+yYC+9lxJR87L5YtY5uWZKkGiUBGkhLmRucSWgb2TT0WjqXxGzvk4PIE0/; AWSALBCORS=XqItYWM1oPeriSd4SLvw6x3e6Qrnp86YuHWzUV7+ixoofDBP0LWqTz0Pkw28zPGlEL+yYC+9lxJR87L5YtY5uWZKkGiUBGkhLmRucSWgb2TT0WjqXxGzvk4PIE0/' | |
done | |
sleep 2 | |
done < /Users/vg/Desktop/l.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment