unfurl/unfurl.py
2026-03-04 11:15:38 -05:00

20 lines
434 B
Python
Executable file

#!/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")