Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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

This comment has been minimized.

Copy link
Owner Author

commented Jan 9, 2018

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
You can’t perform that action at this time.