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.
 
 
 

60 lines
1.1 KiB

  1. #!/bin/bash
  2. scriptpath="$(cd "$(dirname "$0")"; pwd -P)"
  3. instagramUrls=()
  4. if [[ -e transfer ]]
  5. then
  6. echo "Error: ./transfer exists" >&2
  7. exit 1
  8. fi
  9. if ! python3 --version &>/dev/null
  10. then
  11. echo "Error: python3 not found" >&2
  12. exit 1
  13. fi
  14. # ArchiveBot
  15. for f in "$@"
  16. do
  17. upurl="$("${scriptpath}/transfer.notkiska.pw-upload" "${f}")"
  18. echo "${upurl}" >&3
  19. if [[ "${f}" == facebook-* ]]
  20. then
  21. echo "!ao < ${upurl}"
  22. elif [[ "${f}" == twitter-* ]]
  23. then
  24. echo "!ao < ${upurl} --concurrency 6 --delay 0"
  25. elif [[ "${f}" == instagram-* ]]
  26. then
  27. echo "!a < ${upurl}"
  28. instagramUrls+=("${upurl}")
  29. else
  30. echo "!ao < ${upurl}"
  31. fi
  32. done 3>transfer
  33. # Instagram ignores
  34. if [[ ${#instagramUrls[@]} -gt 0 ]]
  35. then
  36. for url in "${instagramUrls[@]}"
  37. do
  38. echo "!ig $("${scriptpath}/archivebot-jobid-calculation" "${url}") ^https?://www.instagram.com/.*[?&]hl="
  39. done
  40. fi
  41. # chromebot
  42. for f in "$@"
  43. do
  44. if [[ "${f}" == facebook-@* || "${f}" == twitter-@* ]]
  45. then
  46. head -1 "${f}"
  47. elif [[ "${f}" == twitter-#* ]]
  48. then
  49. head -4 "${f}"
  50. fi
  51. done | sed 's,^,chromebot: a ,'
  52. echo "Wrote ./transfer, you can run snscrape-wiki-transfer-merge now if ./wiki exists." >&2