|
1 day ago | |
---|---|---|
src | 1 month ago | |
.gitignore | 1 day ago | |
LICENSE | 4 months ago | |
README.md | 1 month ago | |
setup.cfg | 1 month ago | |
setup.py | 2 months ago |
Takiyasha 是用来解锁被加密的音乐文件的工具,支持多种加密格式。
Takiyasha 项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循 License。
Takiyasha 解锁部分加密格式文件的能力,来源于此项目:Unlock Music Project - CLI Edition
如果你只想快点体验,查看安装方法
也可以看看:此项目位于 Notabug 上的备份
.ncm
/.qmc*
/.mflac*
/.mgg*
).qmc
、.mflac
、.mgg
、.ncm
、.kgm
、.vpr
字样的文件。
takiyasha --formats
查看所有支持的加密格式。.mflac*
、.mgg*
).mflac*
、.mgg*
)使用命令:pip install -U takiyasha
使用命令:
Github: pip install -U git+https://github.com/nukemiko/takiyasha
Notabug: pip install -U git+https://notabug.org/MiketsuSmasher/takiyasha
需要你先安装git
。
Takiyasha 提供了 3 个命令入口:
takiyasha
unlocker
takiyasha-unlocker
它们只存在命令长度上的区别。
takiyasha file1 file2 dir1 ...
unlocker file3 file4 dir2 ...
python -m takiyasha file5 file6 dir3 dir4 ...
无论怎样运行,都可以使用 -h/--help
选项获得更多帮助信息。
创建一个 Decoder 对象:
from takiyasha import new_decoder
qmcflac_dec = new_decoder('test.qmcflac')
mflac_dec = new_decoder('test.mflac')
ncm_dec = new_decoder('test.ncm')
noop_dec = new_decoder('test.kv2') # “test.kv2”是扩展名为“kv2”的 mp3 文件
print(qmcflac_dec, mflac_dec, ncm_dec, noop_dec, end='\n')
输出:
<QMCFormatDecoder at 0x7fdbf2057760 name='test.qmcflac'> # QMCv1 加密
<QMCFormatDecoder at 0x7fdbf2ac1090 name='test.mflac'> # QMCv2 加密
<NCMFormatDecoder at 0x7fdbf15622f0 name='test.ncm'> # NCM 加密
<NoOperationDecoder at 0x7fdbf1563400 name='test.kv2'> # 无需解锁操作
执行解锁操作并保存到文件:
save_filename = f'test{idx}.{audio_format}'
with open(save_filename, 'wb') as f:
for block in decoder:
f.write(block)
print('Saved:', save_filename)
输出:
Saved: test0.flac
Saved: test1.flac
Saved: test2.flac
Saved: test3.mp3
使用 file
命令验证输出文件是否正确:
> file test0.flac test1.flac test2.flac test3.mp3
test0.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 13379940 samples
test1.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 16585716 samples
test2.flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 10222154 samples
test3.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 320 kbps, 44.1 kHz, Stereo
针对一些内嵌封面等元数据的加密格式(例如 NCM),还可将其嵌入解锁后的文件:
from takiyasha import new_tag
with open('text2.flac', 'rb') as ncmfile:
tag = new_tag(ncm_decrypted_file)
# 上文中的 NCMFormatDecoder 对象已经储存了找到的元数据
tag.title = ncm_dec.music_title
tag.artist = ncm_dec.music_artists
tag.album = ncm_dec.music_album
tag.comment = ncm_dec.music_identifier
tag.cover = ncm_dec.music_cover_data
ncm_decrypted_file.seek(0, 0)
tag.save(ncm_decrypted_file)
请查看相关 Wiki 页面:问题解决