Created
January 9, 2018 16:57
-
-
Save loisaidasam/260298d8d3aade90df6e55370bac6a2d to your computer and use it in GitHub Desktop.
Solver for https://permanent-redirect.xyz
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
#!/bin/bash | |
# Solver for https://permanent-redirect.xyz | |
# Saves HTML pages to `pages/` dir | |
page="$1"; | |
if [ -z "$page" ] | |
then | |
echo "Pass a starting page!"; | |
exit 1; | |
fi | |
echo "Starting on page $page"; | |
url="https://permanent-redirect.xyz/pages/$page"; | |
filename="pages/$page.html"; | |
mkdir -p pages; | |
while true | |
do | |
echo "$url"; | |
curl -Ss -o "$filename" "$url"; | |
next=$(cat "$filename" | pup 'a attr{href}' | head -n 1); | |
counter=$(cat "$filename" | pup '.counter img attr{alt}' | xargs echo); | |
echo "counter: $counter"; | |
url="https://permanent-redirect.xyz/pages/$next"; | |
filename="pages/$next.html"; | |
# sleep 1; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I DID IT!!!!