Created
August 20, 2013 01:33
-
-
Save sdvcrx/6276156 to your computer and use it in GitHub Desktop.
迅雷链接转换
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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