Convert Figma logo to code with AI

darknessomi logomusicbox

网易云音乐命令行版本

9,804
1,579
9,804
237

Top Related Projects

根据网易云音乐的歌单, 下载flac无损音乐到本地. Download the FLAC music from Internet according to your NeteaseCloudMusic playlist.

search and download music 从网易云音乐、QQ音乐、酷狗音乐、百度音乐、虾米音乐、咪咕音乐等搜索和下载歌曲

2,071

音乐搜索器 - 多站合一音乐搜索解决方案

one for all free music in china (chrome extension, also works for firefox)

高颜值的第三方网易云播放器,支持 Windows / macOS / Linux :electron:

Quick Overview

MusicBox is a command-line interface (CLI) for NetEase Cloud Music, a popular music streaming service in China. It allows users to search, play, and manage their music library directly from the terminal, offering a lightweight and efficient alternative to the web or desktop applications.

Pros

  • Lightweight and fast, consuming minimal system resources
  • Offers a wide range of features, including playlist management, lyrics display, and music downloading
  • Provides a distraction-free, keyboard-driven interface for music enthusiasts
  • Supports both Windows and Unix-like systems

Cons

  • Limited to NetEase Cloud Music service, not compatible with other streaming platforms
  • Requires command-line proficiency, which may be challenging for non-technical users
  • Lacks some advanced features available in the official web or desktop applications
  • May encounter issues with frequent updates to the NetEase Cloud Music API

Code Examples

  1. Logging in to NetEase Cloud Music:
from NEMbox import logger
from NEMbox.api import NetEase

netease = NetEase()
username = input("Enter your username: ")
password = input("Enter your password: ")
login_info = netease.login(username, password)
logger.info(login_info)
  1. Searching for a song:
from NEMbox.api import NetEase

netease = NetEase()
keyword = input("Enter a song name to search: ")
search_results = netease.search(keyword)
for result in search_results['result']['songs'][:5]:
    print(f"{result['name']} - {result['artists'][0]['name']}")
  1. Playing a song:
from NEMbox.player import Player
from NEMbox.api import NetEase

netease = NetEase()
player = Player()
song_id = input("Enter the song ID: ")
song_url = netease.songs_detail([song_id])[0]['url']
player.play(song_url)

Getting Started

To get started with MusicBox, follow these steps:

  1. Install the required dependencies:

    pip install -r requirements.txt
    
  2. Run the MusicBox CLI:

    python3 start.py
    
  3. Use the following commands in the CLI:

    • l: Login to your NetEase Cloud Music account
    • s: Search for songs
    • p: Play the selected song
    • q: Quit the application

For more detailed instructions and additional features, refer to the project's README file on GitHub.

Competitor Comparisons

根据网易云音乐的歌单, 下载flac无损音乐到本地. Download the FLAC music from Internet according to your NeteaseCloudMusic playlist.

Pros of NeteaseCloudMusicFlac

  • Focuses specifically on downloading high-quality FLAC files
  • Simpler and more straightforward for users who only want FLAC downloads
  • Potentially faster for bulk FLAC downloads due to specialized functionality

Cons of NeteaseCloudMusicFlac

  • Limited functionality compared to musicbox's broader feature set
  • Less actively maintained, with fewer recent updates
  • Lacks the command-line interface and playback features of musicbox

Code Comparison

NeteaseCloudMusicFlac:

def get_songurls(song_ids):
    return (
        'http://music.163.com/api/song/enhance/player/url?id={0}&ids=[{0}]&br=320000'.format(i)
        for i in song_ids
    )

musicbox:

def get_song_url(song_id, quality):
    url = 'http://music.163.com/api/song/enhance/player/url?ids=[{0}]&br={1}'.format(
        song_id, quality
    )
    return url

Both projects use similar API endpoints for retrieving song URLs, but musicbox's implementation is more flexible with a quality parameter. NeteaseCloudMusicFlac focuses on high-quality downloads, while musicbox offers more versatility in its functionality.

search and download music 从网易云音乐、QQ音乐、酷狗音乐、百度音乐、虾米音乐、咪咕音乐等搜索和下载歌曲

Pros of music-dl

  • Supports multiple music platforms (NetEase, QQ Music, Kugou, Kuwo, etc.)
  • Command-line interface for easy batch downloading
  • Actively maintained with recent updates

Cons of music-dl

  • Lacks a graphical user interface
  • Does not offer streaming functionality
  • Limited to downloading functionality only

Code Comparison

music-dl:

def download_song(self, song):
    url = self.get_song_url(song)
    filename = self.get_filename(song)
    self.download_file(url, filename)

musicbox:

def play_song(self, song):
    url = self.get_song_url(song)
    player = Player()
    player.play(url)

Key Differences

musicbox is a more comprehensive NetEase Cloud Music client with features like playlist management, streaming, and a text-based user interface. It focuses on providing a complete music listening experience within the terminal.

music-dl, on the other hand, is primarily a downloader that supports multiple platforms. It's designed for users who want to quickly download music from various sources using a simple command-line interface.

While musicbox offers a richer feature set for NetEase Cloud Music users, music-dl provides broader platform support and is more suitable for those who prefer to download and manage their music files locally.

2,071

音乐搜索器 - 多站合一音乐搜索解决方案

Pros of music

  • Web-based interface, making it more accessible across devices
  • Supports multiple music platforms (QQ Music, Netease, Xiami, etc.)
  • More recent updates and active development

Cons of music

  • Less comprehensive command-line functionality
  • May require more setup for server deployment
  • Potentially higher resource usage due to web interface

Code Comparison

musicbox (Python):

def play(self, song, volume=5):
    self.playing_flag = True
    self.process = subprocess.Popen(['mpg123', '-R', '-f', str(volume * 1000), song.get('mp3url')], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    self.process.stdin.write(b'V ' + str(volume).encode() + b'\n')
    self.process.stdin.flush()

music (PHP):

public function search($query, $page = 1)
{
    $result = [];
    foreach ($this->site as $key => $site) {
        $result[$key] = $site->search($query, $page);
    }
    return $result;
}

Summary

musicbox is a command-line based music player with a focus on simplicity and efficiency, while music offers a web-based interface supporting multiple music platforms. musicbox may be preferred for users who prioritize command-line functionality, while music provides a more user-friendly experience for those comfortable with web interfaces. The choice between the two depends on individual preferences and use cases.

one for all free music in china (chrome extension, also works for firefox)

Pros of Listen1 Chrome Extension

  • Cross-platform compatibility as a browser extension
  • User-friendly interface with a modern design
  • Supports multiple music streaming services in one place

Cons of Listen1 Chrome Extension

  • Limited to browser usage, not a standalone application
  • Potentially affected by changes in browser extension policies
  • May have performance limitations compared to native applications

Code Comparison

MusicBox (Python):

def login(self, username, password):
    pattern = re.compile(r'^0\d{2,3}\d{7,8}$|^1[34578]\d{9}$')
    if pattern.match(username):
        return self.phone_login(username, password)
    action = 'https://music.163.com/weapi/login/'
    text = {
        'username': username,
        'password': password,
        'rememberLogin': 'true'
    }
    data = encrypted_request(text)
    try:
        return self.httpRequest('POST', action, data)
    except requests.exceptions.RequestException as e:
        log.error(e)
        return {'code': 501}

Listen1 Chrome Extension (JavaScript):

function getParameterByName(name, url) {
  if (!url) url = window.location.href;
  name = name.replace(/[\[\]]/g, '\\$&');
  var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
      results = regex.exec(url);
  if (!results) return null;
  if (!results[2]) return '';
  return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

The code snippets show different approaches: MusicBox focuses on login functionality, while Listen1 Chrome Extension demonstrates URL parameter parsing. This reflects their distinct architectures and purposes.

高颜值的第三方网易云播放器,支持 Windows / macOS / Linux :electron:

Pros of YesPlayMusic

  • Modern and visually appealing user interface
  • Cross-platform support (Windows, macOS, Linux)
  • Built with Vue.js, offering a responsive and interactive experience

Cons of YesPlayMusic

  • Larger application size due to Electron framework
  • May have higher resource usage compared to command-line interface
  • Potentially slower startup time

Code Comparison

MusicBox (Python):

def login(username, password):
    pattern = re.compile(r'^0\d{2,3}\d{7,8}$|^1[34578]\d{9}$')
    if pattern.match(username):
        return login_phone(username, password)
    action = 'login'
    return auth.login(action, username, password)

YesPlayMusic (JavaScript):

async login(params) {
  const res = await loginAccount(params);
  if (res.code === 200) {
    this.handleLoginSuccess(res);
  }
  return res;
}

Summary

MusicBox is a command-line interface music player for NetEase Cloud Music, written in Python. It offers a lightweight solution for playing music from the terminal.

YesPlayMusic is a modern, cross-platform desktop music player for NetEase Cloud Music, built with Vue.js and Electron. It provides a graphical user interface with a sleek design and enhanced user experience.

While MusicBox is more resource-efficient and faster to start up, YesPlayMusic offers a more visually appealing and user-friendly experience across multiple platforms. The choice between the two depends on user preferences for CLI vs GUI and system resources availability.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

NetEase-MusicBox

感谢为 MusicBox 的开发付出过努力的每一个人!

高品质网易云音乐命令行版本,简洁优雅,丝般顺滑,基于 Python 编写。

Software License versions PyPI - Python Version

Demo

NetEase-MusicBox-GIF

功能特性

  1. 320kbps 的高品质音乐
  2. 歌曲,艺术家,专辑检索
  3. 网易 22 个歌曲排行榜
  4. 网易新碟推荐
  5. 网易精选歌单
  6. 网易主播电台
  7. 私人歌单,每日推荐
  8. 随心打碟
  9. 本地收藏,随时加 ❤
  10. 播放进度及播放模式显示
  11. 现在播放及桌面歌词显示
  12. 歌曲评论显示
  13. 一键进入歌曲专辑
  14. 定时退出
  15. Vimer 式快捷键让操作丝般顺滑
  16. 可使用数字快捷键
  17. 可使用自定义全局快捷键
  18. 对当前歌单列表进行本地模糊搜索

键盘快捷键

有 num + 字样的快捷键可以用数字修饰,按键顺序为先输入数字再键入被修饰的键,即 num + 后的快捷键。

KeyEffect
jDown下移
kUp上移
num + jQuick Jump快速向后跳转 n 首
num + kQuick Up快速向前跳转 n 首
hBack后退
lForword前进
uPrev Page上一页
dNext Page下一页
fSearch当前列表模糊搜索
[Prev Song上一曲
]Next Song下一曲
num + [Quick Prev Song快速前 n 首
num + ]Quick Next Song快速后 n 首
num + Shift + gIndex for Song跳到第 n 首
=Volume +音量增加
-Volume -音量减少
SpacePlay/Pause播放/暂停
?Shuffle手气不错
mMenu主菜单
pPresent/History当前/历史播放列表
iMusic Info当前音乐信息
Shift + pPlaying Mode播放模式切换
aAdd添加曲目到打碟
Shift + aEnter Album进入专辑
gTo the First跳至首项
Shift + gTo the End跳至尾项
zDJ List打碟列表
sStar添加到收藏
cCollection收藏列表
rRemove删除当前条目
Shift + jMove Down向下移动当前项目
Shift + kMove Up向上移动当前项目
Shift + cCache缓存歌曲到本地
,Like喜爱
.Trash FM删除 FM
/Next FM下一 FM
qQuit退出
tTiming Exit定时退出
wQuit & Clear退出并清除用户信息

安装

必选依赖

  1. mpg123 用于播放歌曲,安装方法参见下面的说明
  2. python-fuzzywuzzy 用于模糊搜索

可选依赖

  1. aria2 用于缓存歌曲
  2. libnotify-bin 用于支持消息提示(Linux 平台)
  3. qtpy python-dbus dbus qt 用于支持桌面歌词 (根据系统 qt 的版本还需要安装 pyqt4 pyqt4 pyside pyside2 中的任意一个)
  4. python-levenshtein 用于模糊搜索

PyPi 安装(*nix 系统)

    pip3 install NetEase-MusicBox

Git clone 安装 master 分支(*nix 系统)

    git clone https://github.com/darknessomi/musicbox.git && cd musicbox
    poetry build && poetry install

macOS 安装

    pip3 install NetEase-MusicBox
    brew install mpg123

Linux 安装

注意:通过以下方法安装可能仍然需要pip3 install -U NetEase-MusicBox更新到最新版。

Fedora

首先添加FZUG源,然后sudo dnf install musicbox。

Ubuntu/Debian

    pip3 install NetEase-MusicBox
    sudo apt-get install mpg123

Arch Linux

    pacaur -S netease-musicbox-git # or $ yaourt musicbox

Centos/Red Hat

    sudo yum install -y python3-devel
    pip3 install NetEase-MusicBox
    wget http://mirror.centos.org/centos/7/os/x86_64/Packages/mpg123-1.25.6-1.el7.x86_64.rpm
    sudo yum install -y mpg123-1.25.6-1.el7.x86_64.rpm

配置和错误处理

配置文件地址: ~/.config/netease-musicbox/config.json 可配置缓存,快捷键,消息,桌面歌词。 由于歌曲 API 只接受中国大陆地区访问,非中国大陆地区用户请自行设置代理(可用 polipo 将 socks5 代理转换成 http 代理):

export http_proxy=http://IP:PORT
export https_proxy=http://IP:PORT
curl -L ip.cn

显示 IP 属于中国大陆地区即可。

已测试的系统兼容列表

OSVersion
ArchRolling
macOS10.15.7

错误处理

当某些歌曲不能播放时,总时长为 00:01 时,请检查是否为版权问题导致。

如遇到在特定终端下不能播放问题,首先检查**此终端**下 mpg123 能否正常使用,其次检查**其他终端**下 musicbox 能否正常使用,报告 issue 的时候请告知以上使用情况以及出问题终端的报错信息。

同时,您可以通过tail -f ~/.local/share/netease-musicbox/musicbox.log自行查看日志。 mpg123 最新的版本可能会报找不到声音硬件的错误,测试了 1.25.6 版本可以正常使用。

已知问题及解决方案

  • #374 i3wm 下播放杂音或快进问题,此问题常见于 Arch Linux。尝试更改 mpg123 配置。
  • #405 32 位 Python 下 cookie 时间戳超出了 32 位整数最大值。尝试使用 64 位版本的 Python 或者拷贝 cookie 文件到对应位置。
  • #347 暂停时间超过一定长度(数分钟)之后 mpg123 停止输出,导致切换到下一首歌。此问题是 mpg123 的 bug,暂时无解决方案。
  • #791 版权问题,master 分支已经修复

使用

    musicbox

Enjoy it !

更新日志

2021-01-18 版本 0.3.1 错误修复

2020-10-23 版本 0.3.0 接口更新,错误修复

2018-11-28 版本 0.2.5.4 修复多处错误

2018-06-21 版本 0.2.5.3 修复多处播放错误

2018-06-07 版本 0.2.5.1 修复配置文件错误

2018-06-05 版本 0.2.5.0 全部迁移到新版 api,大量错误修复

更多>>

LICENSE

MIT