Skip to main content

A Netsase music api

Project description

NeteaseMusicApi

一个网易云音乐的Api

食用使用教程

  1. 使用pip安装 pip install nemusicapi
  2. 导入包,创建api
    import nemusicapi
    api = Api()
    
  3. 然后就可以愉快的使用了

举个栗子例子

import os
from NEmusicApi import Api, QualityLevel

download_dir = './download'
cookie = '这里输入cookie'

api = Api(cookie=cookie, download_dir=download_dir)


def main(raw_song_name: str):
    res = api.refresh_song_data(raw_song_name)
    if res is None:
        return
    song_id, song_name = res
    
    level = QualityLevel.hires
    res = api.get_song_download_data(song_id, level=level)
    if res is None:
        return
    song_url, song_type = res
    
    file_name = f'{song_name}_{level.value}.{song_type.value}'
    if not os.path.exists(os.path.join(download_dir, file_name)):
        api.download_song(song_url, file_name)


if __name__ == '__main__':
    main('这里输入歌曲名')

注意事项

  • 创建api的时候,不输入cookie或者cookie对应的账号没有vip,都有可能导致获取信息不完整,需要自己测试
  • 创建api的时候,不输入download_dir,在使用download_song方法的时候会raise异常

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

nemusicapi-0.1.1a4.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nemusicapi-0.1.1a4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file nemusicapi-0.1.1a4.tar.gz.

File metadata

  • Download URL: nemusicapi-0.1.1a4.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10

File hashes

Hashes for nemusicapi-0.1.1a4.tar.gz
Algorithm Hash digest
SHA256 c75ac9b001e03c7f786e70b5b99a72e1ab55a3b263fac4f14d38180ef3d01cd0
MD5 e3ad4e77e3c854aee5605250a6dcae41
BLAKE2b-256 7c6d161663c31ca190237360e24af00adb1ae2bd7d3b78e4d7aea85708ac81f8

See more details on using hashes here.

File details

Details for the file nemusicapi-0.1.1a4-py3-none-any.whl.

File metadata

  • Download URL: nemusicapi-0.1.1a4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10

File hashes

Hashes for nemusicapi-0.1.1a4-py3-none-any.whl
Algorithm Hash digest
SHA256 a389a4354d344133861849da5f06a3eefa71f436fdf2ffcb2d9d03fa541f933a
MD5 49904346285bf45e12e0be6e8cccf370
BLAKE2b-256 6e6b794533149f1d8da9ead77e5e01a3b025b9034052048aa4ab039af7aaf936

See more details on using hashes here.

Supported by

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