# use Advanced Search on the archive to get a CSV file of last 50 items in collection in "addedate desc" order
# save output as search.csv

wget -nv "https://archive.org/advancedsearch.php?q=collection%3Aaccess_humboldt&fl%5B%5D=identifier&sort%5B%5D=addeddate+desc&sort%5B%5D=&sort%5B%5D=&rows=50&page=1&callback=callback&save=yes&output=csv" -O Downloads/last_50_ah_items.csv

# check to see that the csv file looks ok
head Downloads/last_50_ah_items.csv

# create a one line command that will download the torrent file for each item to a "watch" directory 
 
awk '{print "wget -nv https://archive.org/download/" $1 "/" $1 "_archive.torrent -O Downloads/AH/" $1 "_archive.torrent"}' Downloads/last_50_ah_items.csv | grep -v identifier | sed 's/"//g' >get_last_50_ah_items.sh

head ./get_last_50_ah_items.sh 

# make sure the destination directory exists
mkdir Downloads/AH

# execute the torrent downloads
sh ./get_last_50_ah_items.sh 

# check that torrent files exist in the "watch" directory
ls Downloads/AH

# now open up the Bittorrent client that "watches" the directory where the torrent files are

echo now open up qBittorrent to load the torrent files in the "watch" directory