Top Related Projects
:lollipop: Wow, such a beautiful HTML5 music player
:lollipop: Wow, such a lovely HTML5 danmaku video player
高颜值的第三方网易云播放器,支持 Windows / macOS / Linux :electron:
Quick Overview
Meting is a PHP library that provides a unified API for multiple music platforms. It allows developers to easily integrate music streaming functionality from various sources into their applications, supporting platforms like Tencent, NetEase, Xiami, and KuGou.
Pros
- Unified API for multiple music platforms
- Easy integration into existing PHP projects
- Supports caching to improve performance
- Actively maintained and updated
Cons
- Limited to PHP applications
- Dependent on third-party APIs, which may change or become unavailable
- May require additional configuration for certain platforms
- Potential legal concerns regarding music rights and distribution
Code Examples
- Basic usage to search for a song:
<?php
require 'vendor/autoload.php';
use Metowolf\Meting;
$api = new Meting('netease');
$result = $api->format(true)->search('Bohemian Rhapsody');
echo $result;
- Fetching song details:
<?php
$api = new Meting('tencent');
$songId = '0039MnYb0qxYhV';
$result = $api->format(true)->song($songId);
echo $result;
- Getting a playlist:
<?php
$api = new Meting('kugou');
$playlistId = '547134';
$result = $api->format(true)->playlist($playlistId);
echo $result;
Getting Started
- Install Meting using Composer:
composer require metowolf/meting
- Include the library in your PHP file:
<?php
require 'vendor/autoload.php';
use Metowolf\Meting;
// Create a new instance for the desired platform
$api = new Meting('netease');
// Use the API methods
$result = $api->format(true)->search('Your Song Name');
echo $result;
- Configure the API (optional):
$api->cookie('Your cookie');
$api->proxy('http://127.0.0.1:7890');
Competitor Comparisons
:lollipop: Wow, such a beautiful HTML5 music player
Pros of APlayer
- More comprehensive audio player with a full-featured UI
- Supports multiple audio formats including MP3, WAV, and OGG
- Extensive documentation and examples for easy implementation
Cons of APlayer
- Larger file size due to its full-featured nature
- May be overkill for simple audio playback needs
- Less focus on multi-platform music streaming integration
Code Comparison
APlayer:
const ap = new APlayer({
container: document.getElementById('player'),
audio: [{
name: 'Song Name',
artist: 'Artist Name',
url: 'path/to/audio.mp3',
cover: 'path/to/cover.jpg'
}]
});
Meting:
$api = new Meting('netease');
$data = $api->format(true)->search('Song Name');
echo json_encode($data);
Key Differences
- APlayer is primarily a front-end audio player, while Meting focuses on server-side music API integration
- Meting supports multiple music platforms (NetEase, Tencent, etc.), whereas APlayer is platform-agnostic
- APlayer provides a ready-to-use UI, while Meting requires additional front-end implementation
Use Cases
- Choose APlayer for a standalone, feature-rich audio player with minimal setup
- Opt for Meting when integrating multiple music streaming platforms into your application
:lollipop: Wow, such a lovely HTML5 danmaku video player
Pros of DPlayer
- More comprehensive video player with support for multiple formats and streaming protocols
- Extensive customization options and API for developers
- Active development with frequent updates and bug fixes
Cons of DPlayer
- Larger file size and potentially higher resource usage
- Steeper learning curve for basic implementation compared to Meting
Code Comparison
DPlayer:
const dp = new DPlayer({
container: document.getElementById('dplayer'),
video: {
url: 'video.mp4',
type: 'auto'
}
});
Meting:
$api = new Meting('netease');
$data = $api->format(true)->search('Fade', [
'page' => 1,
'limit' => 10
]);
Key Differences
- DPlayer focuses on video playback, while Meting is primarily for audio streaming and music APIs
- DPlayer is JavaScript-based, whereas Meting is PHP-based
- Meting provides a unified API for multiple music platforms, while DPlayer is a standalone video player
Use Cases
- Choose DPlayer for advanced video playback needs with customization options
- Opt for Meting when working with multiple music streaming platforms and requiring a unified API
Both projects serve different purposes and can be complementary in certain scenarios, depending on the specific requirements of your project.
高颜值的第三方网易云播放器,支持 Windows / macOS / Linux :electron:
Pros of YesPlayMusic
- Offers a full-featured music player with a modern, user-friendly interface
- Supports multiple music sources, including NetEase Cloud Music and QQ Music
- Provides a desktop application for Windows, macOS, and Linux
Cons of YesPlayMusic
- Limited to specific music platforms, primarily focused on Chinese services
- Requires more system resources due to its full-featured nature
- May have a steeper learning curve for users unfamiliar with the supported platforms
Code Comparison
Meting (PHP):
$api = new Meting('netease');
$data = $api->format(true)->search('Hello');
YesPlayMusic (JavaScript):
import { neteaseApi } from '@/utils/api';
const result = await neteaseApi.search('Hello');
Summary
Meting is a lightweight PHP API for multiple music platforms, focusing on simplicity and ease of integration. YesPlayMusic, on the other hand, is a full-fledged music player application with a rich user interface, primarily targeting Chinese music services. While Meting offers flexibility for developers to build custom solutions, YesPlayMusic provides a ready-to-use application for end-users. The choice between the two depends on the specific use case and target audience.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
:cake: A powerful music API framework for Node.js
Introduction
Meting is a powerful music API framework designed to accelerate music-related development. This is the Node.js version of the original PHP Meting project, providing unified APIs for multiple music platforms.
Features
- ðµ Multi-Platform Support - Supports NetEase Cloud Music, Tencent Music, KuGou, Baidu Music, and Kuwo
- ð Lightweight & Fast - Zero external dependencies, built with Node.js native modules only
- ð± Modern Async/Await - Promise-based APIs with full async/await support
- ð Unified Interface - Standardized data format across all music platforms
- ð Built-in Encryption - Platform-specific encryption and signing built-in
- â¡ Chain-able API - Fluent interface design for elegant code
Requirements
- Node.js >= 12.0.0
- No external dependencies required
Installation
Install via npm:
npm install @meting/core
Or via yarn:
yarn add @meting/core
Quick Start
Basic Usage
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);
}
Comprehensive Example
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();
API Documentation
Constructor
const meting = new Meting(server);
server(string): Music platform ('netease', 'tencent', 'kugou', 'baidu', 'kuwo')
Core Methods
Platform Management
meting.site(server) // Switch music platform
meting.cookie(cookie) // Set platform-specific cookies
meting.format(enable) // Enable/disable data formatting
Search & Discovery
// Search for songs, albums, or artists
await meting.search(keyword, {
type: 1,
page: 1,
limit: 30,
});
Search Options
type(number, optional) - Search category for providers that support it. NetEase uses1for songs (default),10for albums,100for artists, etc.page(number, optional) - Page number starting from 1. Defaults to1.limit(number, optional) - Number of results per page. Defaults to30.
Music Information
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
Media Resources
await meting.url(id, bitrate) // Get streaming URL
await meting.lyric(id) // Get song lyrics
await meting.pic(id, size) // Get album artwork
Supported Platforms
| Platform | Code | Search | Song | Album | Artist | Playlist | URL | Lyric | Picture |
|---|---|---|---|---|---|---|---|---|---|
| NetEase Cloud Music | netease | â | â | â | â | â | â | â | â |
| Tencent Music | tencent | â | â | â | â | â | â | â | â |
| KuGou Music | kugou | â | â | â | â | â | â | â | â |
| Baidu Music | baidu | â | â | â | â | â | â | â | â |
| Kuwo Music | kuwo | â | â | â | â | â | â | â | â |
Data Format
When format(true) is enabled, all platforms return standardized JSON:
{
"id": "35847388",
"name": "Hello",
"artist": ["Adele"],
"album": "Hello",
"pic_id": "1407374890649284",
"url_id": "35847388",
"lyric_id": "35847388",
"source": "netease"
}
Development
Running Examples
# Install dependencies
npm install
# Run the example
npm start
# or
npm run example
Running Tests
# Run tests for all platforms
npm test
Build from Source
# Build the library
npm run build
# Development mode with file watching
npm run dev
Error Handling
The library uses Promise-based error handling. Always wrap API calls in try-catch blocks:
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');
}
Rate Limiting
To avoid being rate-limited by music platforms:
- Add delays between consecutive requests
- Don't make too many requests in a short time
- Consider implementing request queuing for heavy usage
// Example: Add delay between requests
await new Promise(resolve => setTimeout(resolve, 2000));
Important Notes
- Copyright Compliance: Respect music platform terms of service and copyright laws
- Platform Changes: Music platform APIs may change without notice
- Availability: Some features may be restricted based on geographical location
- Rate Limits: Each platform has different rate limiting policies
Related Projects
- Original PHP Meting - The original PHP version
- MoePlayer/Hermit-X - WordPress music player
- mengkunsoft/MKOnlineMusicPlayer - Online music player
- injahow/meting-api - RESTful API wrapper
- yiyungent/Meting4Net - .NET version
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Meting Node.js © metowolf, Released under the MIT License.
Made with â¤ï¸ for the music community
Top Related Projects
:lollipop: Wow, such a beautiful HTML5 music player
:lollipop: Wow, such a lovely HTML5 danmaku video player
高颜值的第三方网易云播放器,支持 Windows / macOS / Linux :electron:
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot