Download a list of PDFs with Firefox
I failed to download a list of PDFs by Wget, cURL, and Slimerjs. So I used Firefox and shell script.
First, I disable Pdfjs to force Firefox to download PDFs.
I wrote a shell script for opening a URL with PDF file, and then I use xdotool to close the Firefox window. For xdotool command, thank Jon G – Megaphone Tech for his comment at Unix Exchange.
#!/bin/sh for url in `sort -u eng_pdf_urls.txt | grep -i pdf` do echo $url firefox -P exp1 "$url" & sleep 10 echo CLOSE xdotool search "Mozilla Firefox" windowactivate --sync key --window 0 --clearmodifiers alt+F4 sleep 10 done
I didn't use headless because I don't know how to close it properly. I tried timeout command but Firefox detected it as an improper shutdown.