Created
June 29, 2024 05:37
-
-
Save secretGeek/c1edaf2d8e5efa3d9e823832ed3c48d7 to your computer and use it in GitHub Desktop.
Worry Dream download pdfs via Powershell
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
# 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