163music-api

2020-01-14

163music-api

NeteaseMusicApi's TypeScript Version

TypeCloudMusic

NeteaseMusicApi's TypeScript Version

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);
    });

以上是 163music-api 的使用教程帮助文档。


上一篇:1c
下一篇:@typescript-eslint/parser
相关教程
关注微信

扫码加入 JavaScript 社区

相关文章

首次访问,需要验证
微信扫码,关注即可
(仅需验证一次)

欢迎加入 JavaScript 社区

号内回复关键字:

回到顶部