The little things give you away... A collection of various small helper stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

17 lines
604 B

  1. #!/bin/bash
  2. identifier="$1"
  3. if [[ -z "${identifier}" ]]; then exit 1; fi
  4. cookies="$(grep '^logged-in-' ~/.config/ia.ini | sed 's, = ,=,' | tr '\n' ';' | sed 's,;$,,; s,;,; ,')"
  5. result="$(curl -s -H "Cookie: ${cookies}" "https://archive.org/manage/${identifier}" --data "identifier=${identifier}&admin=derive")"
  6. main="$(tr -d '\n' <<<"${result}" | grep -Po '<main.*</main>')"
  7. catalogueUrl="$(grep -Po 'task ID: <a href="\Khttps://catalogd\.archive\.org/log/\d+' <<<"${main}")"
  8. if [[ "${catalogueUrl}" ]]
  9. then
  10. echo "success: ${catalogueUrl}"
  11. else
  12. echo "error: $(sed 's,<[^>]\+>,,g' <<< "${main}")"
  13. fi