Skip to main content

使用 Python 编写的加密音乐解锁工具

Project description

Takiyasha v0.3.3-2

简体中文 | English

Takiyasha 是用来解锁被加密的音乐文件的工具,支持 .qmc、.mflac 等多种格式。

Takiyasha 项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循 License

Takiyasha 解锁 QMC 加密文件的能力,来源于此项目:Unlock Music 音乐解锁

如果你只想快点体验,查看安装方法

特性

  • Takiyasha 使用 Python 3 编写
  • 只要电脑/手机上可以运行 Python 3 和使用 pip,就可以安装和使用 Takiyasha

支持的加密格式

  • 旧版 QMC 加密格式 (.qmc*)
  • 新版 QMC 加密格式 (.mflac/.mflac*/.mgg/.mgg*)
  • QQ 音乐 .tm 格式 (.tm*)
  • Moo Music 加密格式 (.bkc*)
  • NCM 加密格式 (.ncm)
  • KGM 加密格式 (.kgm/.kgma/.vpr)

适用群体

  • 经常批量下载和解锁加密格式的用户
  • 不在乎解锁速度的用户
    • 受限于 Python 的语言特性,解锁过程很慢
  • 想要研究算法和提升自己技术水平的开发者

如何安装

  • 所需运行环境
    • Python 版本:大于或等于 3.8
  • 所需依赖
    • Python 包:click - 提供命令行界面
    • Python 包:mutagen - 向输出文件写入歌曲信息
    • Python 包:pycryptodomex - 部分加密格式的解锁支持

从 Pypi 安装

使用命令:pip install -U takiyasha

通过已发布的 wheel (.whl) 软件包文件安装

从本仓库直接安装

建议从 Pypi 安装或者在发布页面下载安装 Takiyasha。

需要首先安装 git

使用命令:pip install -U git+https://github.com/nukemiko/takiyasha

如何使用

命令行(CMD/Powershell/Terminal 等)

Takiyasha 提供了 3 个命令入口:

  • takiyasha
  • unlocker
  • takiyasha-unlocker

它们只存在命令长度上的区别。

  • 直接执行命令:
    • takiyasha file1.qmcflac file2.mflac ...
    • unlocker file3.kgm file4.vpr ...
  • 直接运行模块:python -m takiyasha file5.mgg file6.ncm ...

无论怎样运行,都可以使用 -h/--help 选项获得更多帮助信息。

作为 Python 模块导入使用

  1. 创建一个 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'>  # 无需解锁操作
    
  2. 执行解锁操作并保存到文件:

    for idx, decoder in enumerate([qmcflac_dec, mflac_dec, ncm_dec, noop_dec]):
        audio_format = decoder.audio_format
        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
    
  3. 针对一些内嵌封面等元数据的加密格式(例如 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_dev.music_cover_data
    
        ncm_decrypted_file.seek(0, 0)
        tag.save(ncm_decrypted_file)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

takiyasha-0.3.3.post2-py3.8_3.9_3.10-none-any.whl (129.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page