This repository has been archived by the owner on Jun 1, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-focus code on downloading URLs, albeit only domain root URLs at th…
…is point in time
- Loading branch information
Showing
6 changed files
with
62 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
[[ -z `which parallel` || ! ($(parallel --version 2>/dev/null) =~ ^GNU.parallel.*) ]] && { echo "GNU parallel is required"; exit 1; } | ||
prefix="$1" | ||
shift | ||
|
||
parallelLimit="${1:-10}" | ||
|
||
enableScreenshot=false | ||
[[ ("$2" == "--screenshot") && ("$3" == "true") ]] && enableScreenshot=true | ||
|
||
cat | parallel --jobs "$parallelLimit" --load "80%" --line-buffer "echo \"{}\"; \"${BASH_SOURCE%/*}/single.sh\" \"{}\" --screenshot \"$enableScreenshot\";" | ||
cat | sed "s_.*_$prefix&/_" | "${BASH_SOURCE%/*}/../url/parallel.sh" "$@" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
enableScreenshot=false | ||
[[ ("$1" == "--screenshot") && ("$2" == "true") ]] && enableScreenshot=true | ||
prefix="$1" | ||
shift | ||
|
||
cat | sed "s_.*_$prefix&/_" | "${BASH_SOURCE%/*}/../url/serial.sh" "$@" | ||
|
||
while read domain; do | ||
echo "$domain" | ||
"${BASH_SOURCE%/*}/single.sh" "$domain" --screenshot "$enableScreenshot" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
domain="$1" | ||
timestamp=$(date -u +%FT%TZ | tr -d ':') | ||
url="http://$domain/" | ||
prefix="$1" | ||
shift | ||
|
||
enableScreenshot=false | ||
[[ ("$2" == "--screenshot") && ("$3" == "true") ]] && enableScreenshot=true | ||
cat | sed "s_.*_$prefix&/_" | "${BASH_SOURCE%/*}/../url/single.sh" "$@" | ||
|
||
outdir="./$domain" | ||
outfilebase="$domain.$timestamp" | ||
outpathhar="$outdir/$outfilebase.har" | ||
outpathpng="$outdir/$outfilebase.png" | ||
|
||
mkdir -p "$outdir" | ||
|
||
result=$("${BASH_SOURCE%/*}/../get/har.sh" "$url" --screenshot "$enableScreenshot") | ||
|
||
if [[ $enableScreenshot == true ]] | ||
then | ||
echo "$result" | jq --raw-output '.screenshot' | base64 --decode > "$outpathpng" | ||
fi | ||
|
||
echo "$result" | jq 'del(.screenshot)' > "$outpathhar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
[[ -z `which parallel` || ! ($(parallel --version 2>/dev/null) =~ ^GNU.parallel.*) ]] && { echo "GNU parallel is required"; exit 1; } | ||
|
||
parallelLimit="${1:-10}" | ||
|
||
enableScreenshot=false | ||
[[ ("$2" == "--screenshot") && ("$3" == "true") ]] && enableScreenshot=true | ||
|
||
cat | parallel --jobs "$parallelLimit" --load "80%" --line-buffer "echo \"{}\"; \"${BASH_SOURCE%/*}/single.sh\" \"{}\" --screenshot \"$enableScreenshot\";" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
enableScreenshot=false | ||
[[ ("$1" == "--screenshot") && ("$2" == "true") ]] && enableScreenshot=true | ||
|
||
while read domain; do | ||
echo "$domain" | ||
"${BASH_SOURCE%/*}/single.sh" "$domain" --screenshot "$enableScreenshot" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
url="$1" | ||
|
||
timestamp=$(date -u +%FT%TZ | tr -d ':') | ||
|
||
enableScreenshot=false | ||
[[ ("$2" == "--screenshot") && ("$3" == "true") ]] && enableScreenshot=true | ||
|
||
getDomain(){ | ||
cut -d'/' -f 3 | cut -d':' -f 1 | ||
} | ||
|
||
domain="$(echo "$url" | getDomain)" | ||
outdir="./$domain" | ||
outfilebase="$domain.$timestamp" | ||
outpathhar="$outdir/$outfilebase.har" | ||
outpathpng="$outdir/$outfilebase.png" | ||
|
||
mkdir -p "$outdir" | ||
|
||
result=$("${BASH_SOURCE%/*}/../get/har.sh" "$url" --screenshot "$enableScreenshot") | ||
|
||
if [[ $enableScreenshot == true ]] | ||
then | ||
echo "$result" | jq --raw-output '.screenshot' | base64 --decode > "$outpathpng" | ||
fi | ||
|
||
echo "$result" | jq 'del(.screenshot)' > "$outpathhar" |