The little things give you away... A collection of various small helper stuff
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

21 rader
722 B

  1. #!/bin/bash
  2. declare -A uas
  3. uas["archivebot"]='ArchiveTeam ArchiveBot/20190427.01 (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'
  4. uas["firefox"]='Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0'
  5. uas["googlebot"]='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
  6. uas["ie6"]='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'
  7. if [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' || -z "${uas[$1]+exists}" ]]
  8. then
  9. echo "Usage: curl-ua NAME ARGS" >&2
  10. echo "" >&2
  11. echo " NAME: name of a UA alias" >&2
  12. echo " ARGS: args for curl" >&2
  13. exit 1
  14. fi
  15. ua="${uas[$1]}"
  16. shift
  17. curl -A "${ua}" "$@"