Created
December 26, 2017 04:21
-
-
Save z3oc/897aeb816882405b837f434cf10a179d to your computer and use it in GitHub Desktop.
Convert cache from .uc! to .mp3 @ music.163.com
This file contains 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
''' | |
Description: convert cache from music.163.com to mp3 | |
Usage: python3 crackmusic163.py sourcefile [...] | |
Output: cache files converted to mp3 in current directory | |
''' | |
def crack163Cache(srcfile): | |
dstfile = srcfile.rstrip('uc!') + 'mp3' | |
with open(srcfile, 'rb') as f1, open(dstfile,'xb') as f2: | |
data = bytearray(f1.read()) | |
for i in range(len(data)): | |
data[i] = data[i] ^ 163 | |
f2.write(data) | |
print("Output:", dstfile) | |
if __name__ == '__main__': | |
import sys | |
if len(sys.argv) < 2: | |
print('Usage: python3', sys.argv[0], 'sourcefile') | |
sys.exit() | |
for file in sys.argv[1:]: | |
if file.endswith('.uc!'): crack163Cache(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment