Skip to content

Instantly share code, notes, and snippets.

@sdvcrx
Created August 20, 2013 01:33
Show Gist options
  • Save sdvcrx/6276156 to your computer and use it in GitHub Desktop.
Save sdvcrx/6276156 to your computer and use it in GitHub Desktop.
迅雷链接转换
import base64
def xunlei_url_encode(url):
return 'thunder://'+base64.encodestring('AA'+url+'ZZ').replace('\n', '')
def xunlei_url_decode(url):
assert url.startswith('thunder://')
url = base64.decodestring(url[10:])
assert url.startswith('AA') and url.endswith('ZZ')
return url[2:-2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment