Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Created January 9, 2018 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loisaidasam/260298d8d3aade90df6e55370bac6a2d to your computer and use it in GitHub Desktop.
Save loisaidasam/260298d8d3aade90df6e55370bac6a2d to your computer and use it in GitHub Desktop.
#!/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
@loisaidasam
Copy link
Author

I DID IT!!!!

screen shot 2018-01-09 at 12 36 07 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment