Skip to content

Instantly share code, notes, and snippets.

@aslian aslian/unadf.ly.py
Created Jul 22, 2014

Embed
What would you like to do?
Decode adf.ly links. Credits https://gist.github.com/alexdrk/6113685
#!/usr/bin/env python
import sys
from base64 import b64decode as atob
from urllib2 import urlopen
from re import search
if len(sys.argv) <= 1:
print """\
[unadf.ly.py - Decode adf.ly links]
Based on github.com/alexdrk approach
Usage: unadf.ly.py <link>
"""
sys.exit()
link = sys.argv[1]
page = urlopen(link).read()
key = search('ysmm\s=\s\'(.*)\'', page).group(True)
parts = ['', '']
for i,v in enumerate(key):
if i%2 == 0:
parts[0] += key[i]
else:
parts[1] = key[i] + parts[1]
print atob(''.join(parts))[2:]
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.