Skip to main content

从音乐平台上获取指定歌曲的标签信息的 Python 库

Project description

MusicTagFindutils

这个 Python 库可以帮助你从 QQ 音乐、网易云音乐等音乐平台上,获取指定歌曲的信息,以便之后将它们写入到音频文件的标签中。

安装

Pypi

pip install -U MusicTagFindutils

本仓库

pip install git+https://github.com/nukemiko/MusicTagFindutils

发布页

最新发布版本:https://github.com/nukemiko/MusicTagFindutils/releases/latest

提供 Wheel 包。

使用

  • 使用网易云音乐作为信息源:

    >>> from tagfindutils import cloudmusic
    >>> cloudmusic_results = cloudmusic.search('朝が来る')
    >>> matched = None
    >>> if cloudmusic_results:
    ...     matched = cloudmusic_results[0]
    ...
    >>> matched
    <
        name: 朝が来る
        trans: 拂晓将至
        aliases: TV动画《鬼灭之刃 花街篇》片尾曲
        artists: Aimer
        album: 朝が来る
        publish time: 2022-01-10 00:00:00
    >
    >>> # 以下命令输出的格式:((歌名, 歌曲 ID), ((歌手 1, 歌手 1 的 ID), (歌手 2(如果有), 歌手 2 的 ID(如果有)), ...), (专辑名, 专辑 ID))
    >>> (matched.songname, matched.songid), tuple(zip(matched.artists, matched.artistids)), (matched.album, matched.albumid)
    (('朝が来る', 1902312104), (('Aimer', 16152),), ('朝が来る', 137312734))
    >>> matched.coverurl  # 封面图像的下载链接
    'http://p4.music.126.net/bCQCvWXXufd7XVvtg5iHkw==/109951166714320898.jpg'
    >>>
    
  • 使用 QQ 音乐作为信息源:

    >>> from tagfindutils import qqmusic
    >>> qqmusic_results = qqmusic.search('Enemies', 'The Score')
    >>> matched = None
    >>> if qqmusic_results:
    ...     matched = qqmusic_results[0]
    ...
    >>> matched
    <
        name: Enemies
        artists: The Score
        album: Enemies
        publish time: 2022-01-14 00:00:00
    >
    >>> # 以下命令输出的格式:((歌名, 歌曲 mID), ((歌手 1, 歌手 1 的 mID), (歌手 2(如果有), 歌手 2 的 mID(如果有)), ...), (专辑名, 专辑 mID))
    >>> (matched.songname, matched.songmid), tuple(zip(matched.artists, matched.artistmids)), (matched.album, matched.albummid)
    (('Enemies', '003nYL8b2u6ygu'), (('The Score', '0023TAHr2UmE2p'),), ('Enemies', '000v14Zi196WkA'))
    >>> matched.coverurl  # 封面图像的下载链接
    'https://y.qq.com/music/photo_new/T002R800x800M000000v14Zi196WkA.jpg'
    >>>
    
  • 从搜索结果获取歌曲的详细信息:

    [...]
    >>> detail = matched.get_detail()
    >>> detail
    <
        name: Enemies
        artists: The Score
        album: Enemies
        publish time: 2022-01-14 00:00:00
        genre: Pop
        company: INgrooves
    >
    >>> # 详细信息和单个搜索结果项相比,只多了“流派(genre)”、“出版方(company)”两个属性
    >>> # 如果使用网易云音乐作为信息源,这两个属性均返回空列表,因为网易云音乐返回的详细信息不包含这两个字段
    >>> # 以下命令输出的格式:([流派 1, 流派 2(如果有), ...], [出版方 1, 出版方 2(如果有), ...])
    >>> (detail.genre, detail.company)
    (['Pop'], ['INgrooves'])
    >>>
    

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

MusicTagFindUtils-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

MusicTagFindUtils-0.1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file MusicTagFindUtils-0.1.1.tar.gz.

File metadata

  • Download URL: MusicTagFindUtils-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.4

File hashes

Hashes for MusicTagFindUtils-0.1.1.tar.gz
Algorithm Hash digest
SHA256 68a89b05a76aa8f269569c25cc957a4cfbc9d10e9dcfcaa516df537a220c698e
MD5 be1a2ea9c64fccc1ac64810ea90f1a43
BLAKE2b-256 08eb7b5384d0aa4f317931604a7ea495143923ccdbe4b1f0fbfd054923a1ccf7

See more details on using hashes here.

File details

Details for the file MusicTagFindUtils-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: MusicTagFindUtils-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.4

File hashes

Hashes for MusicTagFindUtils-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81325192630d5481f21a54caa217e9dbb08191ae53918221fbb8b968b0288dbd
MD5 d16f012210302fa41b3dc1149e5910b4
BLAKE2b-256 218b84426a20562e6d7c128746e1697bfcf31c40505f742a5abe0c04e8a0e55a

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