Skip to content
Mark Graham edited this page Dec 9, 2016 · 2 revisions

Downloading the latest binary of the "ia" command-line tool.

» curl -LOs https://archive.org/download/ia-pex/ia
» chmod +x ia

Adding metadata to a specific file.

By default, ia metadata <id> --modify=<key:value> will modify item-level metadata (e.g. description, creator, etc.). If you wanted to add metadata to a specific file in an item, you can do so with the --target parameter. For example, here is the metadata for https://archive.org/download/jj-test-item-2016-05-11-1/hi.txt:

» ia metadata jj-test-item-2016-05-11-1 | jq '.files[] | select(.name == "hi.txt")'
{
  "size": "3",
  "format": "Text",
  "sha1": "55ca6286e3e4f4fba5d0448333fa99fc5a404a73",
  "mtime": "1472417656",
  "md5": "764efa883dda1e11db47671c4a3bbd9e",
  "source": "original",
  "crc32": "ed6f7a7a",
  "name": "hi.txt"
}

A title could be added to this file's metadata like so:

» ia metadata jj-test-item-2016-05-11-1 --target="files/hi.txt" --modify 'title:Hello World!'
jj-test-item-2016-05-11-1 - success: https://catalogd.archive.org/log/557066496
» ia metadata jj-test-item-2016-05-11-1 | jq '.files[] | select(.name == "hi.txt")'
{
  "title": "Hello World!",
  "size": "3",
  "format": "Text",
  "sha1": "55ca6286e3e4f4fba5d0448333fa99fc5a404a73",
  "mtime": "1472417656",
  "md5": "764efa883dda1e11db47671c4a3bbd9e",
  "source": "original",
  "crc32": "ed6f7a7a",
  "name": "hi.txt"
}

Find top 10 hosts for each Item in a given collection (wide15 in this case)

./ia search --itemlist "collection:wide00015" | parallel -j5 -k --no-notice 'echo {}; curl --header "Cookie: logged-in-sig=$(grep logged-in-sig ~/.config/ia.ini | awk '"'"'{print $NF}'"'"'); logged-in-user=$(grep logged-in-user ~/.config/ia.ini | awk '"'"'{print $NF}'"'"')" -Ls https://archive.org/download/{}/{}.cdx.gz | gunzip | cut -f1 -d")" | uniq -c | sort -nr | head -10; echo ""'