Skip to content

Instantly share code, notes, and snippets.

@ethanpil
Last active March 20, 2020 06:26
Show Gist options
  • Save ethanpil/78e81c3f0384ba522ed87892a54f1581 to your computer and use it in GitHub Desktop.
Save ethanpil/78e81c3f0384ba522ed87892a54f1581 to your computer and use it in GitHub Desktop.
Windows Batch to Download Consecutive Files with Wget
@ECHO OFF
SetLocal EnableDelayedExpansion
FOR /L %%G IN (1, 1, 465) DO (
SET num=%%G
REM You can escape ampersands with ^ like this: ^&
wget -x --load-cookies cookies.txt --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" -O !num!.png https://website.com?year=2012^&page=!num!.png
REM Add a delay between each download
TIMEOUT /T 60 /NOBREAK
)
EndLocal
@ethanpil
Copy link
Author

Above example loads cookes as set already from a cookies.txt file.

Can use a command like this save cookies:
wget -qO- --keep-session-cookies --save-cookies cookies.txt --post-data 'user=MYUSER&password=MYPASS' http://www.domain.com/login.php

Or export from chrome in the cookies.txt format (extension)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment