### Install Dependencies and Run Example Source: https://github.com/metowolf/meting/blob/master/README.md Use npm to install project dependencies and then run the example application. This is a standard setup for Node.js projects. ```bash # Install dependencies npm install ``` ```bash # Run the example npm start # or npm run example ``` -------------------------------- ### Full Music Workflow with Meting.js Source: https://context7.com/metowolf/meting/llms.txt An end-to-end example demonstrating a complete music workflow: searching for a song, retrieving its details, getting a streaming URL, fetching lyrics, obtaining the album cover, and implementing a cross-platform fallback mechanism with error handling. ```javascript import Meting from '@meting/core'; async function musicWorkflow() { const meting = new Meting('netease'); meting.format(true); // ── Step 1: Search ────────────────────────────────────────────────────────── const searchResults = JSON.parse( await meting.search('烟火里的尘埃', { limit: 5 }) ); if (!searchResults.length) { console.error('No results found'); return; } const song = searchResults[0]; console.log(`Found: "${song.name}" by ${song.artist.join(', ')}`); // ── Step 2: Song detail ───────────────────────────────────────────────────── const detail = JSON.parse(await meting.song(song.id)); console.log('Album:', detail[0].album); // ── Step 3: Streaming URL (prefer 320 kbps) ───────────────────────────────── const urlData = JSON.parse(await meting.url(song.url_id, 320)); if (urlData.url) { console.log(`Stream [${urlData.br}kbps, ${urlData.size} bytes]:`, urlData.url); } else { console.warn('Stream unavailable (VIP or region-locked)'); } // ── Step 4: Lyrics ────────────────────────────────────────────────────────── const lyricData = JSON.parse(await meting.lyric(song.lyric_id)); if (lyricData.lyric) { console.log('First lyric line:', lyricData.lyric.split('\n')[1]); } // ── Step 5: Cover art ─────────────────────────────────────────────────────── const pic = JSON.parse(await meting.pic(song.pic_id, 500)); console.log('Cover URL:', pic.url); // ── Step 6: Cross-platform fallback ───────────────────────────────────────── meting.site('tencent'); try { const fallback = JSON.parse(await meting.search('烟火里的尘埃', { limit: 1 })); const tUrl = JSON.parse(await meting.url(fallback[0].url_id, 128)); console.log('Tencent fallback URL:', tUrl.url || '(unavailable)'); } catch (err) { console.error('Tencent fallback failed:', err.message); } } musicWorkflow().catch(console.error); ``` -------------------------------- ### Install @meting/core Source: https://context7.com/metowolf/meting/llms.txt Install the @meting/core package using npm or yarn. ```bash npm install @meting/core # or yarn add @meting/core ``` -------------------------------- ### List Supported Platforms with Meting.js Source: https://context7.com/metowolf/meting/llms.txt Uses the static `getSupportedPlatforms()` method to get a list of all music platforms supported by Meting.js. The example demonstrates iterating through these platforms to perform searches. ```javascript import Meting from '@meting/core'; const platforms = Meting.getSupportedPlatforms(); console.log(platforms); // => ['netease', 'tencent', 'kugou', 'baidu', 'kuwo'] // Dynamically iterate all platforms for (const platform of platforms) { const m = new Meting(platform); m.format(true); console.log(`[${platform}] searching...`); const r = JSON.parse(await m.search('test', { limit: 1 })); console.log(` => ${r[0]?.name ?? 'no results'}`); await new Promise(res => setTimeout(res, 1000)); // rate-limit courtesy delay } ``` -------------------------------- ### Comprehensive Meting.js Example Source: https://github.com/metowolf/meting/blob/master/README.md Demonstrates a full workflow including searching songs, retrieving details, streaming URLs, lyrics, and album art. Also shows how to switch platforms and perform searches. ```javascript import Meting from '@meting/core'; async function musicExample() { const meting = new Meting('netease'); meting.format(true); try { // 1. Search for songs const searchResult = await meting.search('Hello Adele'); const songs = JSON.parse(searchResult); if (songs.length > 0) { const song = songs[0]; console.log(`Found: ${song.name} by ${song.artist.join(', ')}`); // 2. Get song details const details = await meting.song(song.id); console.log('Song details:', JSON.parse(details)); // 3. Get streaming URL const urlInfo = await meting.url(song.url_id, 320); // 320kbps console.log('Streaming URL:', JSON.parse(urlInfo)); // 4. Get lyrics const lyrics = await meting.lyric(song.lyric_id); console.log('Lyrics:', JSON.parse(lyrics)); // 5. Get album cover const cover = await meting.pic(song.pic_id, 300); // 300x300 console.log('Album cover:', JSON.parse(cover)); } // Switch platform and search again meting.site('tencent'); const tencentResult = await meting.search('周杰伦'); console.log('Tencent results:', JSON.parse(tencentResult)); } catch (error) { console.error('Error:', error); } } musicExample(); ``` -------------------------------- ### Install Meting.js via npm Source: https://github.com/metowolf/meting/blob/master/README.md Install the Meting.js core package using npm. Ensure Node.js version is 12.0.0 or higher. ```bash npm install @meting/core ``` -------------------------------- ### Install Meting.js via yarn Source: https://github.com/metowolf/meting/blob/master/README.md Install the Meting.js core package using yarn. Ensure Node.js version is 12.0.0 or higher. ```bash yarn add @meting/core ``` -------------------------------- ### macOS Cookie Example for Netease Source: https://github.com/metowolf/meting/wiki/special-for-netease This is an example of a macOS cookie string. Users may need to collect their own cookies if Netease blocks Meting's. ```text osver=%E7%89%88%E6%9C%AC%2010.13.3%EF%BC%88%E7%89%88%E5%8F%B7%2017D47%EF%BC%89; os=osx; appver=1.5.9; MUSIC_U=*****; channel=netease; ``` -------------------------------- ### PC Cookie Example for Netease Source: https://github.com/metowolf/meting/wiki/special-for-netease This is an example of a PC cookie string that can be used with the `$api->cookie('string')` function. Netease may block Meting's cookie, so users may need to collect their own. ```text os=pc; osver=Microsoft-Windows-10-Professional-build-10586-64bit; appver=2.0.3.131777; channel=netease; __remember_me=true ``` -------------------------------- ### Android Cookie Example for Netease Source: https://github.com/metowolf/meting/wiki/special-for-netease This is an example of an Android cookie string. Users may need to collect their own cookies if Netease blocks Meting's. ```text MUSIC_U=*****; buildver=1506310743; resolution=1920x1080; mobilename=MI5; osver=7.0.1; channel=coolapk; os=android; appver=4.2.0 ``` -------------------------------- ### Promise-based Error Handling with Try-Catch Source: https://github.com/metowolf/meting/blob/master/README.md Wrap API calls in try-catch blocks to handle potential errors gracefully. This example demonstrates searching for a keyword and includes a fallback mechanism. ```javascript try { const result = await meting.search('keyword'); // Handle success } catch (error) { console.error('API Error:', error); // Try fallback platform meting.site('tencent'); const fallback = await meting.search('keyword'); } ``` -------------------------------- ### Get Album Information with Meting API Source: https://context7.com/metowolf/meting/llms.txt Retrieves all tracks within an album using its platform-specific ID. The `format(true)` option normalizes the song data. ```javascript import Meting from '@meting/core'; const meting = new Meting('tencent'); meting.format(true); try { // Tencent album mid (found via search result's album field) const albumId = '002fRO0N4FftzY'; // Example Tencent album ID const tracks = JSON.parse(await meting.album(albumId)); console.log(`Album contains ${tracks.length} tracks:`); tracks.forEach((t, i) => console.log(` ${i + 1}. ${t.name}`)); } catch (err) { console.error('Album fetch error:', err.message); } ``` -------------------------------- ### Add Delay Between Requests Source: https://github.com/metowolf/meting/blob/master/README.md Implement a delay between consecutive requests to avoid hitting rate limits imposed by music platforms. This example uses `setTimeout` wrapped in a Promise. ```javascript // Example: Add delay between requests await new Promise(resolve => setTimeout(resolve, 2000)); ``` -------------------------------- ### Media Resource Retrieval Source: https://github.com/metowolf/meting/blob/master/README.md Methods to get streaming URLs, lyrics, and album artwork. ```APIDOC ## Media Resource Retrieval ```javascript await meting.url(id, bitrate) // Get streaming URL (e.g., 320kbps) await meting.lyric(id) // Get song lyrics await meting.pic(id, size) // Get album artwork (e.g., 300x300) ``` ``` -------------------------------- ### Get Playlist Content with Meting API Source: https://context7.com/metowolf/meting/llms.txt Retrieves all songs from a specified playlist using its platform ID. The `format(true)` option ensures normalized song data. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { // NetEase playlist ID const playlistId = '3136952023'; const tracks = JSON.parse(await meting.playlist(playlistId)); console.log(`Playlist has ${tracks.length} tracks`); // Print first 5 tracks tracks.slice(0, 5).forEach((t, i) => { console.log(`${i + 1}. ${t.name} — ${t.artist.join(', ')}`); }); } catch (err) { console.error('Playlist fetch error:', err.message); } ``` -------------------------------- ### Get Album Cover URL with Meting.js Source: https://context7.com/metowolf/meting/llms.txt Retrieves the album cover URL for a song using its ID. Allows specifying the desired size in pixels. Note that for some providers like NetEase, the URL is constructed client-side, while others may require an internal request. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const search = JSON.parse(await meting.search('Shape of You', { limit: 1 })); const picId = search[0].pic_id; const small = JSON.parse(await meting.pic(picId, 150)); console.log('150px cover:', small.url); // => { url: 'https://p3.music.126.net/...jpg?param=150y150' } const large = JSON.parse(await meting.pic(picId, 800)); console.log('800px cover:', large.url); // => { url: 'https://p3.music.126.net/...jpg?param=800y800' } } catch (err) { console.error('Pic fetch error:', err.message); } ``` -------------------------------- ### Get Song Details with Meting API Source: https://context7.com/metowolf/meting/llms.txt Fetches metadata for a single song using its platform-specific ID. This requires obtaining the song ID first, typically from a search result. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const results = JSON.parse(await meting.search('稻香', { limit: 1 })); const songId = results[0].id; const detail = JSON.parse(await meting.song(songId)); const song = detail[0]; console.log(`Title : ${song.name}`); console.log(`Artist: ${song.artist.join(', ')}`); console.log(`Album : ${song.album}`); console.log(`Source: ${song.source}`); // Title : 稻香 // Artist: 周杰伦 // Album : 魔杰座 // Source: netease } catch (err) { console.error('Song fetch error:', err.message); } ``` -------------------------------- ### Get Artist's Songs with Meting API Source: https://context7.com/metowolf/meting/llms.txt Fetches a list of top songs for a given artist ID. An optional `limit` parameter can be used to control the number of returned tracks. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { // NetEase artist ID for Jay Chou const artistId = '2116'; const songs = JSON.parse(await meting.artist(artistId, 10)); console.log(`Top ${songs.length} songs:`); songs.forEach(s => console.log(` • ${s.name}`)); // • 稻香 // • 晴天 // • 七里香 // ... } catch (err) { console.error('Artist fetch error:', err.message); } ``` -------------------------------- ### Get Streaming URL with Meting API Source: https://context7.com/metowolf/meting/llms.txt Resolves a playable streaming URL for a song using its ID. You can specify a preferred bitrate; the API returns the highest available quality up to that bitrate. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const search = JSON.parse(await meting.search('Hello Adele', { limit: 1 })); const urlId = search[0].url_id; // Request 320 kbps const hq = JSON.parse(await meting.url(urlId, 320)); console.log(hq); // => { url: 'https://m701.music.126.net/...mp3', size: 12345678, br: 320 } // Request 128 kbps fallback const lq = JSON.parse(await meting.url(urlId, 128)); console.log(lq); // => { url: 'https://m701.music.126.net/...mp3', size: 4567890, br: 128 } // Unavailable / VIP track // => { url: '', size: 0, br: -1 } } catch (err) { console.error('URL fetch error:', err.message); } ``` -------------------------------- ### Constructor Source: https://github.com/metowolf/meting/blob/master/README.md Initializes a new Meting instance for a specified music platform. ```APIDOC ## Constructor ```javascript const meting = new Meting(server); ``` - `server` (string): Music platform ('netease', 'tencent', 'kugou', 'baidu', 'kuwo') ``` -------------------------------- ### Initialize Meting Instance and Check Platforms Source: https://context7.com/metowolf/meting/llms.txt Create a Meting instance for a specific platform and check supported platforms. The constructor accepts 'netease', 'tencent', 'kugou', 'baidu', or 'kuwo'. Unsupported platforms default to 'netease'. ```javascript import Meting from '@meting/core'; // Create an instance for NetEase Cloud Music const meting = new Meting('netease'); // Enable normalized output format meting.format(true); // Check supported platforms console.log(Meting.getSupportedPlatforms()); // => ['netease', 'tencent', 'kugou', 'baidu', 'kuwo'] console.log(Meting.isSupported('tencent')); // => true console.log(Meting.isSupported('spotify')); // => false ``` -------------------------------- ### Switch Music Platform with site() Source: https://context7.com/metowolf/meting/llms.txt Switch the active music platform on an existing Meting instance using the `site()` method. This allows you to query different platforms sequentially. The method returns the instance for chaining. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); // Search NetEase first, then switch to Tencent const neteaseResults = JSON.parse(await meting.search('周杰伦', { limit: 2 })); console.log('NetEase:', neteaseResults[0].source); // => 'netease' meting.site('tencent'); const tencentResults = JSON.parse(await meting.search('周杰伦', { limit: 2 })); console.log('Tencent:', tencentResults[0].source); // => 'tencent' ``` -------------------------------- ### Constructor: new Meting(server) Source: https://context7.com/metowolf/meting/llms.txt Creates a new Meting instance targeting a specific music platform. Supported platforms are 'netease', 'tencent', 'kugou', 'baidu', and 'kuwo'. Defaults to 'netease' if an unsupported platform is provided. ```APIDOC ## Constructor: new Meting(server) ### Description Creates a new Meting instance targeting the specified music platform. Accepts `'netease'`, `'tencent'`, `'kugou'`, `'baidu'`, or `'kuwo'`. If an unsupported platform is passed it silently falls back to `'netease'`. ### Parameters #### Path Parameters - **server** (string) - Required - The music platform to target (e.g., 'netease'). ### Static Methods #### `Meting.getSupportedPlatforms()` Returns an array of supported platform strings. #### `Meting.isSupported(platform)` Checks if a given platform string is supported. ### Example ```javascript import Meting from '@meting/core'; // Create an instance for NetEase Cloud Music const meting = new Meting('netease'); // Enable normalized output format meting.format(true); // Check supported platforms console.log(Meting.getSupportedPlatforms()); // => ['netease', 'tencent', 'kugou', 'baidu', 'kuwo'] console.log(Meting.isSupported('tencent')); // => true console.log(Meting.isSupported('spotify')); // => false ``` ``` -------------------------------- ### Meting.js Constructor Source: https://github.com/metowolf/meting/blob/master/README.md Initialize a new Meting instance with a specified music platform server. Supported servers include 'netease', 'tencent', 'kugou', 'baidu', and 'kuwo'. ```javascript const meting = new Meting(server); ``` -------------------------------- ### Basic Meting.js Usage Source: https://github.com/metowolf/meting/blob/master/README.md Initialize Meting.js with a music platform and search for songs. Enable data formatting for consistent output. Handles potential search errors. ```javascript import Meting from '@meting/core'; // Initialize with a music platform const meting = new Meting('netease'); // 'netease', 'tencent', 'kugou', 'baidu', 'kuwo' // Enable data formatting for consistent output meting.format(true); // Search for songs try { const searchResult = await meting.search('Hello Adele', { page: 1, limit: 10 }); const songs = JSON.parse(searchResult); console.log(songs); } catch (error) { console.error('Search failed:', error); } ``` -------------------------------- ### Run Production Build Source: https://github.com/metowolf/meting/blob/master/CLAUDE.md Execute these commands in your terminal to build the project, run tests, and publish. ```bash npm run build # 构建两种格式到 lib/ 目录 npm test # 构建后运行测试验证 npm publish # 发布前会自动执行 prepublishOnly 构建命令 ``` -------------------------------- ### meting.site(server) Source: https://context7.com/metowolf/meting/llms.txt Switches the active music platform on an existing Meting instance. This method returns the instance itself, allowing for method chaining. ```APIDOC ## `meting.site(server)` — Switch Platform ### Description Switches the active music platform on an existing instance. Returns the instance for chaining. ### Parameters #### Path Parameters - **server** (string) - Required - The music platform to switch to (e.g., 'tencent'). ### Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); // Search NetEase first, then switch to Tencent const neteaseResults = JSON.parse(await meting.search('周杰伦', { limit: 2 })); console.log('NetEase:', neteaseResults[0].source); // => 'netease' meting.site('tencent'); const tencentResults = JSON.parse(await meting.search('周杰伦', { limit: 2 })); console.log('Tencent:', tencentResults[0].source); // => 'tencent' ``` ``` -------------------------------- ### Build Library and Development Mode Source: https://github.com/metowolf/meting/blob/master/README.md Commands to build the Meting Node.js library for production or to run it in development mode with file watching enabled. ```bash # Build the library npm run build ``` ```bash # Development mode with file watching npm run dev ``` -------------------------------- ### Run Tests for All Platforms Source: https://github.com/metowolf/meting/blob/master/README.md Execute the test suite for all supported music platforms using npm. This command ensures the library functions correctly across different services. ```bash # Run tests for all platforms npm test ``` -------------------------------- ### Meting.js Media Resource Methods Source: https://github.com/metowolf/meting/blob/master/README.md Fetch media resources such as streaming URLs, lyrics, and album artwork for songs and albums. ```javascript await meting.url(id, bitrate) // Get streaming URL await meting.lyric(id) // Get song lyrics await meting.pic(id, size) // Get album artwork ``` -------------------------------- ### Meting.getSupportedPlatforms() Source: https://context7.com/metowolf/meting/llms.txt A static method that lists all music platforms supported by the Meting library. ```APIDOC ## `Meting.getSupportedPlatforms()` — List Platforms (Static) Static method that returns an array of all supported platform identifiers without needing an instance. ### Response #### Success Response (200) - **platforms** (array) - An array of strings, where each string is a supported platform identifier. ### Request Example ```javascript import Meting from '@meting/core'; const platforms = Meting.getSupportedPlatforms(); console.log(platforms); // => ['netease', 'tencent', 'kugou', 'baidu', 'kuwo'] // Dynamically iterate all platforms for (const platform of platforms) { const m = new Meting(platform); m.format(true); console.log(`[${platform}] searching...`); const r = JSON.parse(await m.search('test', { limit: 1 })); console.log(` => ${r[0]?.name ?? 'no results'}`); await new Promise(res => setTimeout(res, 1000)); // rate-limit courtesy delay } ``` ``` -------------------------------- ### Meting.js Music Information Methods Source: https://github.com/metowolf/meting/blob/master/README.md Retrieve detailed information about songs, albums, artists, and playlists using their respective IDs. ```javascript await meting.song(id) // Get song details await meting.album(id) // Get album information await meting.artist(id, limit) // Get artist's songs await meting.playlist(id) // Get playlist content ``` -------------------------------- ### Meting.js Platform Management Methods Source: https://github.com/metowolf/meting/blob/master/README.md Control the active music platform, set cookies, and enable/disable data formatting for consistent API responses. ```javascript meting.site(server) // Switch music platform meting.cookie(cookie) // Set platform-specific cookies meting.format(enable) // Enable/disable data formatting ``` -------------------------------- ### meting.url(id, bitrate?) Source: https://context7.com/metowolf/meting/llms.txt Resolves a playable streaming URL for a song. The bitrate parameter (default 320, in kbps) is a preference — the library returns the highest available quality that does not exceed the requested bitrate. ```APIDOC ## `meting.url(id, bitrate?)` — Get Streaming URL ### Description Resolves a playable streaming URL for a song. The `bitrate` parameter (default `320`, in kbps) is a preference — the library returns the highest available quality that does not exceed the requested bitrate. ### Parameters #### Path Parameters - **id** (string) - Required - The platform-specific ID of the song. - **bitrate** (number) - Optional - The preferred bitrate in kbps (default `320`). ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const search = JSON.parse(await meting.search('Hello Adele', { limit: 1 })); const urlId = search[0].url_id; // Request 320 kbps const hq = JSON.parse(await meting.url(urlId, 320)); console.log(hq); // Request 128 kbps fallback const lq = JSON.parse(await meting.url(urlId, 128)); console.log(lq); // Unavailable / VIP track // => { url: '', size: 0, br: -1 } } catch (err) { console.error('URL fetch error:', err.message); } ``` ``` -------------------------------- ### meting.pic(id, size?) Source: https://context7.com/metowolf/meting/llms.txt Retrieves the album cover URL for a song. The size parameter allows specifying the desired dimensions of the cover image. ```APIDOC ## `meting.pic(id, size?)` — Get Album Cover URL Returns a direct URL to the album cover image. The `size` parameter (default `300`) specifies the pixel dimensions (width × height). This method does not make an HTTP request for NetEase and Tencent — it constructs the URL client-side; other providers (KuGou, Baidu, Kuwo) make an internal song-detail request to resolve the image URL. ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the album cover. - **size** (number) - Optional - The desired pixel dimensions (width x height) for the cover image. Defaults to 300. ### Response #### Success Response (200) - **url** (string) - The direct URL to the album cover image. ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const search = JSON.parse(await meting.search('Shape of You', { limit: 1 })); const picId = search[0].pic_id; const small = JSON.parse(await meting.pic(picId, 150)); console.log('150px cover:', small.url); // => { url: 'https://p3.music.126.net/...jpg?param=150y150' } const large = JSON.parse(await meting.pic(picId, 800)); console.log('800px cover:', large.url); // => { url: 'https://p3.music.126.net/...jpg?param=800y800' } } catch (err) { console.error('Pic fetch error:', err.message); } ``` ``` -------------------------------- ### meting.search(keyword, option?) Source: https://context7.com/metowolf/meting/llms.txt Searches for songs on the active platform. Returns a JSON string (array of song objects when format(true) is active). ```APIDOC ## `meting.search(keyword, option?)` — Search Songs ### Description Searches for songs on the active platform. Returns a JSON string (array of song objects when `format(true)` is active). ### Parameters #### Query Parameters - **keyword** (string) - Required - The search term for songs. - **option** (object) - Optional - Configuration for the search. - **type** (number) - Optional - Search category (platform-specific; NetEase: `1`=songs, `10`=albums, `100`=artists). - **page** (number) - Optional - Page number (default `1`). - **limit** (number) - Optional - Results per page (default `30`). ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { // Basic keyword search const results = JSON.parse(await meting.search('烟火里的尘埃', { limit: 3 })); results.forEach(song => { console.log(`${song.name} — ${song.artist.join(', ')} (${song.source})`); }); // Paginated search const page2 = JSON.parse(await meting.search('rock', { page: 2, limit: 5 })); console.log(`Page 2 has ${page2.length} results`); // Album search on NetEase (type=10) const albums = JSON.parse(await meting.search('The Beatles', { type: 10, limit: 5 })); console.log('Albums found:', albums.length); } catch (err) { console.error('Search error:', err.message); } ``` ``` -------------------------------- ### meting.format(enable) Source: https://context7.com/metowolf/meting/llms.txt Toggles the output format for API methods. When enabled (`true`), responses are normalized to a standard structure. When disabled (`false`), raw platform JSON is returned. ```APIDOC ## `meting.format(enable)` — Toggle Normalized Output ### Description When called with `true`, all API methods return a normalized JSON array (or object) instead of the raw platform response. The normalized format uses the fields `id`, `name`, `artist` (array), `album`, `pic_id`, `url_id`, `lyric_id`, and `source`. ### Parameters #### Path Parameters - **enable** (boolean) - Required - `true` to enable normalized output, `false` for raw output. ### Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); // Raw platform response meting.format(false); const raw = await meting.search('Hello Adele', { limit: 1 }); console.log(typeof JSON.parse(raw)); // => 'object' (raw NetEase API shape) // Normalized response meting.format(true); const normalized = JSON.parse(await meting.search('Hello Adele', { limit: 1 })); console.log(normalized[0]); // => { // id: '35847388', // name: 'Hello', // artist: ['Adele'], // album: 'Hello', // pic_id: '1407374890649284', // url_id: '35847388', // lyric_id: '35847388', // source: 'netease' // } ``` ``` -------------------------------- ### Platform Management Source: https://github.com/metowolf/meting/blob/master/README.md Methods for managing the current music platform, cookies, and data formatting. ```APIDOC ## Platform Management ```javascript meting.site(server) // Switch music platform meting.cookie(cookie) // Set platform-specific cookies meting.format(enable) // Enable/disable data formatting ``` ``` -------------------------------- ### meting.playlist(id) Source: https://context7.com/metowolf/meting/llms.txt Fetches all songs from a user-created or curated playlist by its platform ID. ```APIDOC ## `meting.playlist(id)` — Get Playlist Content ### Description Fetches all songs from a user-created or curated playlist by its platform ID. ### Parameters #### Path Parameters - **id** (string) - Required - The platform-specific ID of the playlist. ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { // NetEase playlist ID const playlistId = '3136952023'; const tracks = JSON.parse(await meting.playlist(playlistId)); console.log(`Playlist has ${tracks.length} tracks`); // Print first 5 tracks tracks.slice(0, 5).forEach((t, i) => { console.log(`${i + 1}. ${t.name} — ${t.artist.join(', ')}`); }); } catch (err) { console.error('Playlist fetch error:', err.message); } ``` ``` -------------------------------- ### meting.album(id) Source: https://context7.com/metowolf/meting/llms.txt Returns all tracks in an album, normalized to the standard song format when format(true) is enabled. ```APIDOC ## `meting.album(id)` — Get Album Information ### Description Returns all tracks in an album, normalized to the standard song format when `format(true)` is enabled. ### Parameters #### Path Parameters - **id** (string) - Required - The platform-specific ID of the album. ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('tencent'); meting.format(true); try { // Tencent album mid (found via search result's album field) const albumId = '002fRO0N4FftzY'; // Example Tencent album ID const tracks = JSON.parse(await meting.album(albumId)); console.log(`Album contains ${tracks.length} tracks:`); tracks.forEach((t, i) => console.log(` ${i + 1}. ${t.name}`)); } catch (err) { console.error('Album fetch error:', err.message); } ``` ``` -------------------------------- ### Toggle Normalized Output with format() Source: https://context7.com/metowolf/meting/llms.txt Enable or disable the normalized output format using the `format()` method. When enabled (`true`), API methods return standardized objects with fields like `id`, `name`, `artist`, `album`, etc. When disabled (`false`), raw platform JSON is returned. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); // Raw platform response meting.format(false); const raw = await meting.search('Hello Adele', { limit: 1 }); console.log(typeof JSON.parse(raw)); // => 'object' (raw NetEase API shape) // Normalized response meting.format(true); const normalized = JSON.parse(await meting.search('Hello Adele', { limit: 1 })); console.log(normalized[0]); // => { // id: '35847388', // name: 'Hello', // artist: ['Adele'], // album: 'Hello', // pic_id: '1407374890649284', // url_id: '35847388', // lyric_id: '35847388', // source: 'netease' // } ``` -------------------------------- ### Fetch Song Lyrics with Meting.js Source: https://context7.com/metowolf/meting/llms.txt Fetches timed lyrics for a song using its ID. Handles potential errors during the fetch process and prints the first few lines of the LRC format lyrics. Also checks for and logs translated lyrics if available. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const search = JSON.parse(await meting.search('晴天 周杰伦', { limit: 1 })); const lyricId = search[0].lyric_id; const data = JSON.parse(await meting.lyric(lyricId)); // Print first 5 LRC lines const lines = data.lyric.split('\n').filter(l => l.trim()).slice(0, 5); lines.forEach(line => console.log(line)); // [00:18.22]故事的小黄花 // [00:21.40]从出生那年就飘着 // ... // Translation (may be empty string) if (data.tlyric) { console.log('Has translation:', data.tlyric.slice(0, 60)); } } catch (err) { console.error('Lyric fetch error:', err.message); } ``` -------------------------------- ### Search Songs with Meting API Source: https://context7.com/metowolf/meting/llms.txt Searches for songs using a keyword and optional parameters like type, page, and limit. Ensure the Meting instance is initialized and format is set if needed. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { // Basic keyword search const results = JSON.parse(await meting.search('烟火里的尘埃', { limit: 3 })); results.forEach(song => { console.log(`${song.name} — ${song.artist.join(', ')} (${song.source})`); }); // => 烟火里的尘埃 — 许巍 (netease) // => 烟火里的尘埃 (Live) — 许巍 (netease) // Paginated search const page2 = JSON.parse(await meting.search('rock', { page: 2, limit: 5 })); console.log(`Page 2 has ${page2.length} results`); // Album search on NetEase (type=10) const albums = JSON.parse(await meting.search('The Beatles', { type: 10, limit: 5 })); console.log('Albums found:', albums.length); } catch (err) { console.error('Search error:', err.message); } ``` -------------------------------- ### Meting.js Search Method Source: https://github.com/metowolf/meting/blob/master/README.md Search for songs, albums, or artists using a keyword. Supports optional parameters for type, page number, and results limit. ```javascript // Search for songs, albums, or artists await meting.search(keyword, { type: 1, page: 1, limit: 30, }); ``` -------------------------------- ### meting.artist(id, limit?) Source: https://context7.com/metowolf/meting/llms.txt Retrieves the top songs for a given artist. The optional limit parameter (default 50) caps the number of returned tracks. ```APIDOC ## `meting.artist(id, limit?)` — Get Artist's Songs ### Description Retrieves the top songs for a given artist. The optional `limit` parameter (default `50`) caps the number of returned tracks. ### Parameters #### Path Parameters - **id** (string) - Required - The platform-specific ID of the artist. - **limit** (number) - Optional - The maximum number of songs to return (default `50`). ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { // NetEase artist ID for Jay Chou const artistId = '2116'; const songs = JSON.parse(await meting.artist(artistId, 10)); console.log(`Top ${songs.length} songs:`); songs.forEach(s => console.log(` • ${s.name}`)); } catch (err) { console.error('Artist fetch error:', err.message); } ``` ``` -------------------------------- ### meting.song(id) Source: https://context7.com/metowolf/meting/llms.txt Fetches metadata for a single song by its platform-specific ID. ```APIDOC ## `meting.song(id)` — Get Song Details ### Description Fetches metadata for a single song by its platform-specific ID. ### Parameters #### Path Parameters - **id** (string) - Required - The platform-specific ID of the song. ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const results = JSON.parse(await meting.search('稻香', { limit: 1 })); const songId = results[0].id; const detail = JSON.parse(await meting.song(songId)); const song = detail[0]; console.log(`Title : ${song.name}`); console.log(`Artist: ${song.artist.join(', ')}`); console.log(`Album : ${song.album}`); console.log(`Source: ${song.source}`); } catch (err) { console.error('Song fetch error:', err.message); } ``` ``` -------------------------------- ### Search Source: https://github.com/metowolf/meting/blob/master/README.md Searches for songs, albums, or artists across supported platforms. ```APIDOC ## Search ```javascript await meting.search(keyword, { type: 1, // Search category (e.g., 1 for songs) page: 1, // Page number limit: 30, // Results per page }); ``` ### Search Options - `type` (number, optional): Search category. Defaults to song search. - `page` (number, optional): Page number, starting from 1. Defaults to `1`. - `limit` (number, optional): Number of results per page. Defaults to `30`. ``` -------------------------------- ### Standardized JSON Data Format Source: https://github.com/metowolf/meting/blob/master/README.md When format(true) is enabled, all platforms return standardized JSON. This format includes details like song ID, name, artist, album, and source. ```json { "id": "35847388", "name": "Hello", "artist": ["Adele"], "album": "Hello", "pic_id": "1407374890649284", "url_id": "35847388", "lyric_id": "35847388", "source": "netease" } ``` -------------------------------- ### Set Platform Cookie with cookie() Source: https://context7.com/metowolf/meting/llms.txt Inject a platform-specific cookie string using the `cookie()` method for authenticated or higher-quality responses. This is required by some API endpoints. The method returns the instance for chaining. ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); // Provide a NetEase login cookie for higher-quality streams meting.cookie('MUSIC_U=your_netease_music_u_token; __csrf=your_csrf_token;'); const urlResult = JSON.parse(await meting.url('35847388', 320)); console.log(urlResult); // => { url: 'https://...mp3', size: 11234567, br: 320 } ``` -------------------------------- ### meting.cookie(cookie) Source: https://context7.com/metowolf/meting/llms.txt Injects a platform-specific cookie string into all subsequent HTTP requests. This is often necessary for authenticated access or to retrieve higher-quality responses. The method returns the instance for chaining. ```APIDOC ## `meting.cookie(cookie)` — Set Cookie ### Description Injects a platform-specific cookie string into all subsequent HTTP requests. Required by some endpoints for authenticated or higher-quality responses. Returns the instance for chaining. ### Parameters #### Path Parameters - **cookie** (string) - Required - The platform-specific cookie string. ### Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); // Provide a NetEase login cookie for higher-quality streams meting.cookie('MUSIC_U=your_netease_music_u_token; __csrf=your_csrf_token;'); const urlResult = JSON.parse(await meting.url('35847388', 320)); console.log(urlResult); // => { url: 'https://...mp3', size: 11234567, br: 320 } ``` ``` -------------------------------- ### meting.lyric(id) Source: https://context7.com/metowolf/meting/llms.txt Fetches timed lyrics for a song using its ID. Returns an object containing the LRC-formatted lyrics and optionally translated lyrics. ```APIDOC ## `meting.lyric(id)` — Get Song Lyrics Fetches timed lyrics for a song. Returns an object with `lyric` (LRC-format string) and `tlyric` (translated lyrics, if available). ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the song. ### Response #### Success Response (200) - **lyric** (string) - The LRC-formatted lyrics for the song. - **tlyric** (string) - The translated lyrics for the song (if available). ### Request Example ```javascript import Meting from '@meting/core'; const meting = new Meting('netease'); meting.format(true); try { const search = JSON.parse(await meting.search('晴天 周杰伦', { limit: 1 })); const lyricId = search[0].lyric_id; const data = JSON.parse(await meting.lyric(lyricId)); // Print first 5 LRC lines const lines = data.lyric.split('\n').filter(l => l.trim()).slice(0, 5); lines.forEach(line => console.log(line)); // [00:18.22]故事的小黄花 // [00:21.40]从出生那年就飘着 // ... // Translation (may be empty string) if (data.tlyric) { console.log('Has translation:', data.tlyric.slice(0, 60)); } } catch (err) { console.error('Lyric fetch error:', err.message); } ``` ``` -------------------------------- ### Music Information Retrieval Source: https://github.com/metowolf/meting/blob/master/README.md Methods to retrieve detailed information about songs, albums, artists, and playlists. ```APIDOC ## Music Information Retrieval ```javascript await meting.song(id) // Get song details await meting.album(id) // Get album information await meting.artist(id, limit) // Get artist's songs await meting.playlist(id) // Get playlist content ``` ``` -------------------------------- ### Netease Song URL API Source: https://github.com/metowolf/meting/wiki/special-for-netease This is an alternative API endpoint for obtaining Netease Cloud Music song URLs. Replace {{id}} with the song's ID. ```url https://music.163.com/song/media/outer/url?id={{id}}.mp3 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.