#Meting API
The Meting class is the core class for interacting with the Meting API, providing methods to retrieve all music resources.
#Constructor
declare class class Meting Meting {
constructor(server: string | undefined server ?: string);
}| Parameter | Type | Default | Description |
|---|---|---|---|
server | string | 'netease' | Music platform, e.g., netease |
#Configuration Methods
#site
Set the music platform.
declare class class Meting Meting {
Meting.site(server: string): this site (server: string server : string): this;
}| Parameter | Type | Description |
|---|---|---|
server | string | Platform name, e.g., netease |
#api
Set a custom API endpoint. Default is https://api.qijieya.cn/meting/.
declare class class Meting Meting {
Meting.api(url: string): this api (url: string url : string): this;
}| Parameter | Type | Description |
|---|---|---|
url | string | Meting API endpoint |
#cookie
Set a cookie for authenticated requests.
declare class class Meting Meting {
Meting.cookie(cookie: string): this cookie (cookie: string cookie : string): this;
}| Parameter | Type | Description |
|---|---|---|
cookie | string | Cookie string |
#format
Enable or disable formatted responses. When enabled, returned data will be unified to the Music interface format.
declare class class Meting Meting {
Meting.format(enable: boolean): this format (enable: boolean enable : boolean): this;
}| Parameter | Type | Description |
|---|---|---|
enable | boolean | Whether to enable formatting |
#Data Methods
All data methods return a Promise<string> (JSON string).
#search
Search for songs.
interface SearchOptions {
SearchOptions.type?: number | undefined type ?: number;
SearchOptions.page?: number | undefined page ?: number;
SearchOptions.limit?: number | undefined limit ?: number;
}
declare class class Meting Meting {
Meting.search(keyword: string, options?: SearchOptions): Promise<string> search (keyword: string keyword : string, options: SearchOptions | undefined options ?: SearchOptions): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Default | Description |
|---|---|---|---|
keyword | string | — | Search keyword |
options.type | number | 1 | Search type |
options.page | number | 1 | Page number |
options.limit | number | 30 | Results per page |
#song
Get single song information.
declare class class Meting Meting {
Meting.song(id: string | number): Promise<string> song (id: string | number id : string | number): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Description |
|---|---|---|
id | string | number | Song ID |
#artist
Get a list of songs by an artist.
declare class class Meting Meting {
Meting.artist(id: string | number, limit?: number): Promise<string> artist (id: string | number id : string | number, limit: number | undefined limit ?: number): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | number | — | Artist ID |
limit | number | 30 | Number of results |
#playlist
Get all songs in a playlist.
declare class class Meting Meting {
Meting.playlist(id: string | number): Promise<string> playlist (id: string | number id : string | number): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Description |
|---|---|---|
id | string | number | Playlist ID |
#url
Get song playback URL.
declare class class Meting Meting {
Meting.url(id: string | number, bitrate?: number): Promise<string> url (id: string | number id : string | number, bitrate: number | undefined bitrate ?: number): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | number | — | Song ID |
bitrate | number | 320 | Audio bitrate |
#lyric
Get lyrics information.
declare class class Meting Meting {
Meting.lyric(id: string | number): Promise<string> lyric (id: string | number id : string | number): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Description |
|---|---|---|
id | string | number | Lyrics ID |
#pic
Get cover image information.
declare class class Meting Meting {
Meting.pic(id: string | number, size?: number): Promise<string> pic (id: string | number id : string | number, size: number | undefined size ?: number): interface Promise<T>Represents the completion of an asynchronous operation
Promise <string>;
}| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | number | — | Image ID |
size | number | 300 | Image size (px) |
#Type Definitions
#SearchOptions
interface SearchOptions {
SearchOptions.type?: number | undefined type ?: number; // Search type: 1=song, 100=artist, 1000=album, 1004=playlist, 1006=lyrics, 1009=user
SearchOptions.page?: number | undefined page ?: number; // Page number, default 1
SearchOptions.limit?: number | undefined limit ?: number; // Results per page, default 30
}#Music
interface Music {
Music.id: string id : string; // Song ID
Music.name: string name : string; // Song name
Music.artist: string[] artist : string[]; // Artist list
Music.album: string album : string; // Album name
Music.pic_id: string pic_id : string; // Cover image ID
Music.pic: string pic : string; // Cover image URL
Music.url_id: string url_id : string; // Playback URL or ID
Music.lyric_id: string lyric_id : string; // Lyrics ID
Music.lrc: string lrc : string; // Lyrics URL
Music.source: string source : string; // Source platform
}#MusicResponse
interface MusicResponse {
MusicResponse.id: string id : string;
MusicResponse.name: string name : string;
MusicResponse.artist: string[] artist : string[];
MusicResponse.album: string album : string;
MusicResponse.pic: string pic : string;
MusicResponse.url: string url : string;
MusicResponse.lrc: string lrc : string;
MusicResponse.source: string source : string;
[key: string key : string]: unknown;
}#Complete Example
import { class Meting Meting } from 'music-getter';
const const meting: Meting meting = new new Meting(server?: string): Meting Meting ('netease');
const meting: Meting meting .Meting.format(enable: boolean): Meting format (true);
// Search
const const searchResults: any searchResults = var JSON: JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
JSON .JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyConverts a JavaScript Object Notation (JSON) string into an object.
@paramtext A valid JSON string.@paramreviver A function that transforms the results. This function is called for each member of the object.
If a member contains nested objects, the nested objects are transformed before the parent object is.@throws{SyntaxError} If text is not valid JSON. parse (
await const meting: Meting meting .Meting.search(keyword: string, options?: SearchOptions): Promise<string> search ('Jay Chou', { SearchOptions.type?: number | undefined type : 1, SearchOptions.limit?: number | undefined limit : 5 })
);
// Get song details
const const song: any song = var JSON: JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
JSON .JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyConverts a JavaScript Object Notation (JSON) string into an object.
@paramtext A valid JSON string.@paramreviver A function that transforms the results. This function is called for each member of the object.
If a member contains nested objects, the nested objects are transformed before the parent object is.@throws{SyntaxError} If text is not valid JSON. parse (await const meting: Meting meting .Meting.song(id: string | number): Promise<string> song ('1372188635'));
// Get playlist
const const playlist: any playlist = var JSON: JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
JSON .JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyConverts a JavaScript Object Notation (JSON) string into an object.
@paramtext A valid JSON string.@paramreviver A function that transforms the results. This function is called for each member of the object.
If a member contains nested objects, the nested objects are transformed before the parent object is.@throws{SyntaxError} If text is not valid JSON. parse (await const meting: Meting meting .Meting.playlist(id: string | number): Promise<string> playlist ('7697114803'));
// Get playback URL
const const urlData: any urlData = var JSON: JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
JSON .JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyConverts a JavaScript Object Notation (JSON) string into an object.
@paramtext A valid JSON string.@paramreviver A function that transforms the results. This function is called for each member of the object.
If a member contains nested objects, the nested objects are transformed before the parent object is.@throws{SyntaxError} If text is not valid JSON. parse (await const meting: Meting meting .Meting.url(id: string | number, bitrate?: number): Promise<string> url ('1372188635', 320));
// Get lyrics
const const lyricData: any lyricData = var JSON: JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
JSON .JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyConverts a JavaScript Object Notation (JSON) string into an object.
@paramtext A valid JSON string.@paramreviver A function that transforms the results. This function is called for each member of the object.
If a member contains nested objects, the nested objects are transformed before the parent object is.@throws{SyntaxError} If text is not valid JSON. parse (await const meting: Meting meting .Meting.lyric(id: string | number): Promise<string> lyric ('1372188635'));
// Get cover
const const picData: any picData = var JSON: JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
JSON .JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyConverts a JavaScript Object Notation (JSON) string into an object.
@paramtext A valid JSON string.@paramreviver A function that transforms the results. This function is called for each member of the object.
If a member contains nested objects, the nested objects are transformed before the parent object is.@throws{SyntaxError} If text is not valid JSON. parse (await const meting: Meting meting .Meting.pic(id: string | number, size?: number): Promise<string> pic ('1372188635', 300));