Skip to content

Instantly share code, notes, and snippets.

@secretGeek
Created June 29, 2024 05:37
Show Gist options
  • Save secretGeek/c1edaf2d8e5efa3d9e823832ed3c48d7 to your computer and use it in GitHub Desktop.
Save secretGeek/c1edaf2d8e5efa3d9e823832ed3c48d7 to your computer and use it in GitHub Desktop.
Worry Dream download pdfs via Powershell
# get all the links from "https://worrydream.com/refs/" into a file - links.csv
Invoke-WebRequest –Uri https://worrydream.com/refs/ | % { $_.Links.href } | out-file "links.csv" -encoding utf8 #clipp
# re-format them as complete urls (they are just relative currently)
get-content .\links.csv | % { "https://worrydream.com/refs/" + $_ } | out-file urls.csv -Encoding utf8
# download the pdfs (to the local folder, with name named after the file)
get-content .\urls.csv | % {
$url = $_;
$fileName = (($url -split "/") | select -last 1);
invoke-webrequest $url -Outfile $fileName;
wh "$fileName" -f magenta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment