Add current http user agent module and support for fetch-uri. - annna - Annna the nice friendly bot.
 (HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
       ---
 (DIR) commit 9f216582f4f0539d89d85c9890e6ff7183630d4b
 (DIR) parent 4c01d8108ec317371e198de78a6a0cdfd1ec3040
 (HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Thu, 16 Mar 2023 18:45:04 +0100
       
       Add current http user agent module and support for fetch-uri.
       
       Thanks eidolon for the suggestion.
       
       Diffstat:
         M fetch-uri                           |       6 +++++-
         A http-user-agent                     |       4 ++++
         A modules/http-user-agent/get-user-a… |      15 +++++++++++++++
       
       3 files changed, 24 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/fetch-uri b/fetch-uri
       @@ -1,5 +1,7 @@
        #!/bin/sh
        
       +export PATH="$HOME/bin:$PATH"
       +
        usage() {
                printf "usage: %s [-h] URI\n" "$(basename "$0")" >&2
                exit 1
       @@ -17,11 +19,13 @@ then
                shift
        fi
        
       +
       +
        curl \
                --preproxy socks5://127.0.0.1:9100 \
                -s \
                -L --max-redirs 3 \
                -m 5 \
       -        -H 'User-Agent:' \
       +        -H "User-Agent: $(http-user-agent)" \
                $opth \
                "$1" 2>/dev/null
 (DIR) diff --git a/http-user-agent b/http-user-agent
       @@ -0,0 +1,4 @@
       +#!/bin/sh
       +
       +useragentfile="$HOME/bin/modules/http-user-agent/user-agents.txt"
       +shuf -n 1 ${useragentfile}
 (DIR) diff --git a/modules/http-user-agent/get-user-agents.sh b/modules/http-user-agent/get-user-agents.sh
       @@ -0,0 +1,15 @@
       +#!/bin/sh
       +
       +useragentfile="$HOME/bin/modules/user-agent/user-agents.txt"
       +
       +{
       +        for browser in chrome firefox;
       +        do
       +                for os in windows osx;
       +                do
       +                        curl -s "https://api.user-agent.io/?browser=${browser}&os=${os}"
       +                        printf "\n"
       +                done
       +        done
       +} > $useragentfile
       +