@huanlin/163music-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

TypeCloudMusic

NeteaseMusicApi's TypeScript Version

这儿 fork 的 原作者好像并没有 pub 到 npm,不方便开发使用

Install

Install TypeScript in global is recommended.

[sudo] npm -g install typescript

Clone it in your project.

git clone https://github.com/pboymt/TypeCloudMusic.git
npm install

Compile to JavaScript.

tsc

Usage

Import in TypeScript.

import { search, album, artistAlbums, comments } from './lib/main';

Import in JavaScript.

const { search, album, artistAlbums, comments } = require('./dist/main');

Use Search API

e.g. id is 1234

// Callback
search('周杰伦', (data) => {
    console.log(data);
});

// Promise
search('周杰伦')
    .then((data) => {
        console.log(data);
    })
    .catch((err) => {
        console.log(err);
    });

Use Album API

e.g. id is 34944913

// Callback
album(34944913, (data) => {
    console.log(data);
});

// Promise
album(34944913)
    .then((data) => {
        console.log(data);
    })
    .catch((err) => {
        console.log(err);
    });

Use ArtistAlbums API

e.g. id is 6452

// Callback
artistAlbums(6452, (data) => {
    console.log(data);
});

// Promise
artistAlbums(6452)
    .then((data) => {
        console.log(data);
    })
    .catch((err) => {
        console.log(err);
    });

Use Comments API

e.g. id is 1234

// Callback
comments(30394891, (data) => {
    console.log(data);
});

// Promise
comments(30394891)
    .then((data) => {
        console.log(data);
    })
    .catch((err) => {
        console.log(err);
    });

Package Sidebar

Install

npm i @huanlin/163music-api

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

24.3 kB

Total Files

22

Last publish

Collaborators

  • huanlin