From c474b7d96d7516d07d7c2386a2e1145c82d62e8f Mon Sep 17 00:00:00 2001 From: Alex Kelly Date: Wed, 4 Mar 2026 11:15:38 -0500 Subject: [PATCH] initial commit --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ unfurl.py | 20 ++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 README.md create mode 100755 unfurl.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..937aa56 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# unfurl.py + +Is Avanan email protection forced on you? Do you click avanan-checked links +only to get a stupid sad document icon with an inside-out umbrella telling you +"something went wrong" when all you wanted to do was change your email +preferences from some stupid newsletter? + +That's all this script does. It "unfucks" the URL that avanan wrapped in its +own rewritten link. + +Conveniently, their urls use a predictable +http://url.avanan.click/___your_actual_url___/moreavananbs + +This script just takes that jumbled URL, and plucks out the stuff between the +___'s. + +# Usage + +## interactive +``` +unfurl.py +``` + +You'll be prompted for the url. + +## As argument +``` +unfurl.py "avananlink" +``` + +## As stdin +``` +echo "avananlink" | unfurl.py +``` + +## directly from your clipboard, and then put the cleaned one back on your clipboard +(using wayland's wl-copy/paste commands, but you can adjust based on whatever +your clipboard manager is) +``` +wl-paste | unfurl.py | wl-copyunf +``` diff --git a/unfurl.py b/unfurl.py new file mode 100755 index 0000000..292f0ed --- /dev/null +++ b/unfurl.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +import sys +import urllib.parse + +if not sys.stdin.isatty(): + url = sys.stdin.read().strip() +elif len(sys.argv) > 1: + url = sys.argv[1] +else: + url = input("Paste URL: ") + +# Extract between ___ markers +start = url.find("___") + 3 +end = url.find("___", start) + +if start > 2 and end > 0: + extracted = url[start:end] + print(urllib.parse.unquote(extracted)) +else: + print("Could not find ___ markers")