Browse Source

Queue derives with `ia tasks` instead of this manual curl rubbish

master
JustAnotherArchivist 2 years ago
parent
commit
a4627fa1c6
1 changed files with 1 additions and 13 deletions
  1. +1
    -13
      ia-derive

+ 1
- 13
ia-derive View File

@@ -1,16 +1,4 @@
#!/bin/bash
identifier="$1"
if [[ -z "${identifier}" ]]; then exit 1; fi

cookies="$(grep '^logged-in-' ~/.config/ia.ini | sed 's, = ,=,' | tr '\n' ';' | sed 's,;$,,; s,;,; ,')"

result="$(curl -s -H "Cookie: ${cookies}" "https://archive.org/manage/${identifier}" --data "identifier=${identifier}&admin=derive")"

main="$(tr -d '\n' <<<"${result}" | grep -Po '<main.*</main>')"
catalogueUrl="$(grep -Po 'task ID: <a href="\Khttps://catalogd\.archive\.org/log/\d+' <<<"${main}")"
if [[ "${catalogueUrl}" ]]
then
echo "success: ${catalogueUrl}"
else
echo "error: $(sed 's,<[^>]\+>,,g' <<< "${main}")"
fi
exec ia tasks "${identifier}" --cmd derive.php

Loading…
Cancel
Save