Add current http user agent module and support for fetch-uri. - annna - Annna t… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 9f216582f4f0539d89d85c9890e6ff7183630d4b | |
parent 4c01d8108ec317371e198de78a6a0cdfd1ec3040 | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
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 | |
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} | |
diff --git a/modules/http-user-agent/get-user-agents.sh b/modules/http-user-age… | |
@@ -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}… | |
+ printf "\n" | |
+ done | |
+ done | |
+} > $useragentfile | |
+ |