def decrypt_key(key): bgsalt = addon.getSetting('bgsalt') # Reverse engineered from http://static.beeg.com/cpl/1738.js a = bgsalt e = compat_urllib_parse_unquote(key) o = ''.join([ compat_chr(compat_ord(e[n]) - compat_ord(a[n % len(a)]) % 21) for n in range(len(e))]) return ''.join(split(o, 3)[::-1])