Skip to main content

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

Project description

Takiyasha

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

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

Takiyasha 解锁部分加密格式文件的能力,来源于此项目:Unlock Music Project - CLI Edition

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

也可以看看:此项目位于 Notabug 上的备份

特性

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

支持的加密格式

  • 请在安装后使用 takiyasha --formats 查看支持的加密格式。
    • 不支持 Apple Music/Spotify 等平台的加密格式

适用群体

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

如何安装

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

(推荐)从 Pypi 安装

使用命令:pip install -U takiyasha

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

如何使用

命令行(CMD/Powershell/Terminal 等)

Takiyasha 提供了 3 个命令入口:

  • takiyasha
  • unlocker
  • takiyasha-unlocker

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

  • 直接执行命令:
    • takiyasha file1 file2 ...
    • unlocker file3 file4 ...
  • 直接运行模块:python -m takiyasha file5 file6 ...

无论怎样运行,都可以使用 -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_dec.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 Distribution

takiyasha-0.4.0.tar.gz (128.3 kB view details)

Uploaded Source

Built Distribution

takiyasha-0.4.0-py3-none-any.whl (132.8 kB view details)

Uploaded Python 3

File details

Details for the file takiyasha-0.4.0.tar.gz.

File metadata

  • Download URL: takiyasha-0.4.0.tar.gz
  • Upload date:
  • Size: 128.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for takiyasha-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dfbb4cc0e23ffdf656e09b75a4aa43529ed80ac8ae65494a4f61e511ca682642
MD5 8f547d29e3cae2b16ec80f71e0080fa4
BLAKE2b-256 513004d450bf8263443df1d4f7edcf2aa6a95a85984a82473097e109f0c3d3de

See more details on using hashes here.

File details

Details for the file takiyasha-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: takiyasha-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 132.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for takiyasha-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c45d0a84c43e936622e2167ff8165757b17985c079c7eb40676c023c69dc46c4
MD5 a7a6992bcffc8c4d365f56d82b845df1
BLAKE2b-256 6f877884ed63b5c18485418798186ebc2e8d7eb91dcda79e9acfb70653c45615

See more details on using hashes here.

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