Convert Figma logo to code with AI

0xHJK logomusic-dl

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

3,755
539
3,755
42

Top Related Projects

🌈谷粒-Chrome插件英雄榜, 为优秀的Chrome插件写一本中文说明书, 让Chrome插件英雄们造福人类~ ChromePluginHeroes, Write a Chinese manual for the excellent Chrome plugin, let the Chrome plugin heroes benefit the human~ 公众号「0加1」同步更新

8,093

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.

131,248

Command-line program to download videos from YouTube.com and other video sites

82,065

A feature-rich command-line audio/video downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).

网易云音乐 Node.js API service

Quick Overview

Music-dl is a command-line tool for searching and downloading music from various online platforms. It supports multiple sources, including NetEase, QQ Music, Kugou, Kuwo, and Migu. The project aims to provide a simple and efficient way to download high-quality music files from these popular Chinese music streaming services.

Pros

  • Supports multiple popular Chinese music streaming platforms
  • Command-line interface for easy integration into scripts and workflows
  • Allows searching and downloading of individual songs or entire playlists
  • Provides options for selecting audio quality and file format

Cons

  • Limited to Chinese music streaming platforms, may not be useful for international users
  • Potential legal concerns regarding downloading copyrighted material
  • Requires Python environment and dependencies to be set up
  • May break if the supported platforms change their APIs or implement stricter protection measures

Code Examples

  1. Searching for a song:
from music_dl import config
from music_dl.source import MusicSource

config.init()
ms = MusicSource()
result = ms.search("周杰伦 - 稻香")
for song in result:
    print(f"{song.title} - {song.singer}")
  1. Downloading a song:
from music_dl import config
from music_dl.source import MusicSource

config.init()
ms = MusicSource()
result = ms.search("周杰伦 - 稻香", limit=1)
if result:
    song = result[0]
    song.download()
  1. Configuring download options:
from music_dl import config

config.init()
config.set("outdir", "/path/to/download/directory")
config.set("quality", "lossless")
config.set("format", "flac")

Getting Started

  1. Install music-dl using pip:

    pip install music-dl
    
  2. Run music-dl from the command line:

    music-dl "周杰伦 - 稻香"
    
  3. For more options, use the help command:

    music-dl --help
    

Competitor Comparisons

🌈谷粒-Chrome插件英雄榜, 为优秀的Chrome插件写一本中文说明书, 让Chrome插件英雄们造福人类~ ChromePluginHeroes, Write a Chinese manual for the excellent Chrome plugin, let the Chrome plugin heroes benefit the human~ 公众号「0加1」同步更新

Pros of ChromeAppHeroes

  • Comprehensive guide for Chrome extensions, offering valuable insights for users
  • Regular updates with new extensions and features
  • Well-organized content with detailed explanations and use cases

Cons of ChromeAppHeroes

  • Focused solely on Chrome extensions, limiting its scope compared to music-dl
  • May require more time to find specific information due to its extensive content
  • Not a functional tool like music-dl, but rather an informational resource

Code Comparison

While a direct code comparison is not relevant due to the different nature of these projects, we can highlight their main purposes:

music-dl:

def download_music(url, output_dir):
    # Code to download music from various sources

ChromeAppHeroes:

## Extension Name
- Description
- Usage instructions
- Benefits

music-dl is a functional tool for downloading music, while ChromeAppHeroes is a documentation project for Chrome extensions. The code structures reflect their distinct purposes, with music-dl focusing on Python-based downloading functionality and ChromeAppHeroes utilizing Markdown for organizing and presenting information about Chrome extensions.

8,093

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.

Pros of yewtube

  • Offers a terminal-based interface for streaming and downloading YouTube content
  • Supports playlist management and local playlists
  • Provides a more comprehensive YouTube experience with search, playback, and download features

Cons of yewtube

  • Limited to YouTube as the sole source for music and videos
  • May require more system resources due to its broader feature set
  • Less focused on multi-platform music downloading compared to music-dl

Code Comparison

music-dl:

def download(url, song):
    filename = '{}.mp3'.format(song.name)
    logger.info('Downloading: %s', filename)
    r = requests.get(url, stream=True)
    with open(filename, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024):
            if chunk:
                f.write(chunk)

yewtube:

def download(song, filename=None, path=None):
    filename = _get_filename(song, filename=filename, path=path)
    stream = pafy.new(song.ytid).getbestaudio()
    stream.download(filepath=filename, quiet=False)
    return filename

Both projects offer downloading functionality, but yewtube integrates with the pafy library for YouTube interactions, while music-dl uses a more generic approach with requests. yewtube's implementation is more concise and tailored for YouTube, whereas music-dl's code suggests broader platform support.

131,248

Command-line program to download videos from YouTube.com and other video sites

Pros of youtube-dl

  • Supports a vast number of websites and platforms for video/audio extraction
  • Highly customizable with numerous options for format selection and output
  • Active development with frequent updates and bug fixes

Cons of youtube-dl

  • Primarily focused on video downloading, requiring additional steps for audio extraction
  • Can be complex for users seeking a simple music download solution
  • Larger codebase and broader scope, potentially impacting performance for music-only tasks

Code Comparison

music-dl:

def download(url, song_name, artist, album, cover_url, lyrics, **kwargs):
    # Simplified download function focused on music
    # ...

youtube-dl:

def extract_info(url, download=True, ie_key=None, extra_info=None, process=True, force_generic_extractor=False):
    # More complex extraction function for various media types
    # ...

Summary

youtube-dl is a versatile tool for downloading media from numerous sources, while music-dl is specifically designed for music downloads. youtube-dl offers broader platform support and more customization options, but may be overkill for users solely interested in music. music-dl provides a more streamlined experience for music downloads, with features like lyrics and cover art integration, but lacks the extensive platform support of youtube-dl.

82,065

A feature-rich command-line audio/video downloader

Pros of yt-dlp

  • Supports a wider range of platforms and websites, including YouTube and many others
  • More actively maintained with frequent updates and bug fixes
  • Offers advanced features like format selection, playlist handling, and post-processing options

Cons of yt-dlp

  • More complex to use, especially for beginners
  • Primarily focused on video downloading, requiring additional steps for audio extraction
  • Larger codebase and dependencies, potentially leading to longer installation times

Code comparison

music-dl:

def download(self, url, song_name, artist, album, cover_url, lyric):
    filename = f'{artist} - {song_name}.mp3'
    self.logger.info(f'Downloading {filename}')
    # Download logic here

yt-dlp:

ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])

music-dl is specifically designed for music downloads, with a simpler interface and built-in metadata handling. yt-dlp offers more flexibility and options but requires more configuration for audio-only downloads.

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).

Pros of spotify-downloader

  • More focused on Spotify, offering better integration and support for Spotify-specific features
  • Actively maintained with regular updates and a larger community
  • Supports downloading entire playlists and albums efficiently

Cons of spotify-downloader

  • Limited to Spotify as the primary source, less versatile for other platforms
  • May require additional setup and dependencies specific to Spotify API

Code Comparison

music-dl:

def download(url, outdir='.', quality='best', merge=True, lyrics=False):
    song = Song(url, outdir)
    song.download(quality=quality, merge=merge, lyrics=lyrics)
    return song

spotify-downloader:

def download_track(track_url, output_format="mp3", quality="best", lyrics=True):
    track = spotify.track(track_url)
    audio = youtube.search(track)
    download_file(audio.url, f"{track.name}.{output_format}")
    if lyrics:
        add_lyrics(track, f"{track.name}.{output_format}")

Summary

While music-dl offers a more versatile approach for downloading music from various sources, spotify-downloader excels in Spotify-specific functionality. The latter provides better integration with Spotify's features and is more actively maintained. However, music-dl may be preferable for users seeking a broader range of music sources beyond Spotify. The code comparison highlights the different approaches, with spotify-downloader focusing on Spotify track information and YouTube as the audio source.

网易云音乐 Node.js API service

Pros of NeteaseCloudMusicApi

  • Provides a comprehensive API for accessing NetEase Cloud Music services
  • Supports a wide range of functionalities, including user authentication, playlist management, and song details
  • Regularly updated with new features and bug fixes

Cons of NeteaseCloudMusicApi

  • Focused solely on NetEase Cloud Music, limiting its use for other music platforms
  • Requires more setup and configuration compared to music-dl
  • May have a steeper learning curve for users unfamiliar with API integration

Code Comparison

music-dl:

from music_dl import config
from music_dl.source import MusicSource

config.init()
ms = MusicSource()
result = ms.search("song name")

NeteaseCloudMusicApi:

const { login_cellphone, user_playlist } = require('NeteaseCloudMusicApi')

login_cellphone({
  phone: 'xxx',
  password: 'yyy'
}).then(result => {
  console.log(result)
  user_playlist({
    uid: result.body.account.id
  }).then(data => {
    console.log(data)
  })
})

The code snippets demonstrate that music-dl offers a simpler interface for searching and downloading music, while NeteaseCloudMusicApi provides more detailed control over various NetEase Cloud Music functionalities, but requires more complex setup and usage.

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

Music-dl: Listen to what you want

music-dl


Music-dl is a command line tool which helps you search and download music from multiple sources.

Support for QQ music, Netease music, Xiami music, Kugou music and Baidu music. See supported sources.

Python3 Only. Python 3.5+ Recommended.

English | 中文文档

**Music-dl **是一个基于Python3的命令行工具,可以从多个网站搜索和下载音乐,方便寻找音乐,解决不知道哪个网站有版权的问题。工具的本意是聚合搜索,API 是从公开的网络中获得,不是破解版,也听不了付费歌曲。

禁止将本工具用于商业用途,如产生法律纠纷与本人无关,如有侵权,请联系我删除。

微博:可乐芬达王老吉

QQ群:785798493

最近API封杀有点多,个人有点维护不过来,需要大家帮忙更新。查看 支持的音乐源列表

注意: 部分音乐源在一些国家和地区不可用,可以考虑使用中国大陆代理。获取公共代理的方式可以参考我的另一个项目https://github.com/0xHJK/Proxies,两分钟获得数千个有效代理。

功能

  • 部分歌曲支持无损音乐
  • 优先搜索高品质音乐(无损 -> 320K -> 128K)
  • 支持 HTTP 和 SOCKS 代理
  • 支持多线程搜索
  • 支持搜索结果去重和排序
  • 支持搜索关键字高亮
  • 支持下载歌词和封面(部分)

注意:仅支持Python3,建议使用 Python3.5 以上版本

安装

使用pip安装(推荐,注意前面有一个py):

$ pip3 install pymusic-dl

手动安装(最新):

$ git clone https://github.com/0xHJK/music-dl.git
$ cd music-dl
$ python3 setup.py install

不安装直接运行:

$ git clone https://github.com/0xHJK/music-dl.git
$ cd music-dl
$ pip3 install -r requirements.txt
$ ./music-dl

# 或 python3 music-dl

在以下环境测试通过:

系统名称系统版本Python版本
macOS10.143.7.0
macOS10.133.7.0
WindowsWindows 7 x643.7.2
WindowsWindows 10 x643.7.2
Ubuntu16.04 x643.5.2

使用方式

v3.0预览版命令有较大的改变,建议先查看帮助

$ music-dl --help
Usage: music-dl [OPTIONS]

  Search and download music from netease, qq, kugou, baidu and xiami.
  Example: music-dl -k "周杰伦"

Options:
  --version             Show the version and exit.
  -k, --keyword TEXT    搜索关键字,歌名和歌手同时输入可以提高匹配(如 空帆船 朴树)
  -u, --url TEXT        通过指定的歌曲URL下载音乐
  -p, --playlist TEXT   通过指定的歌单URL下载音乐
  -s, --source TEXT     Supported music source: qq netease kugou baidu
  -n, --number INTEGER  Number of search results
  -o, --outdir TEXT     Output directory
  -x, --proxy TEXT      Proxy (e.g. http://127.0.0.1:1087)
  -v, --verbose         Verbose mode
  --lyrics              同时下载歌词
  --cover               同时下载封面
  --nomerge             不对搜索结果列表排序和去重
  --help                Show this message and exit.
  • 默认搜索qq netease kugou baidu ,每个数量限制为5,保存目录为当前目录。
  • 指定序号时可以使用1-5 7 10的形式。
  • 默认对搜索结果排序和去重,排序顺序按照歌手和歌名排序,当两者都相同时保留最大的文件。
  • 无损音乐歌曲数量较少,如果没有无损会显示320K或128K。
  • 支持http代理和socks代理,格式形如-x http://127.0.0.1:1087或-x socks5://127.0.0.1:1086

示例:

支持的音乐源列表

音乐源缩写网址有效无损320K封面歌词歌单单曲
QQ音乐qqhttps://y.qq.com/✓--✕✓✕✕
酷狗音乐kugouhttp://www.kugou.com/✓---✕-✕
网易云音乐neteasehttps://music.163.com/✓-✓✓✓✓✓
咪咕音乐miguhttp://www.migu.cn/✓✓✓✓✓✕✕
百度音乐baiduhttp://music.baidu.com/✓-✓✓✓✕✕
虾米音乐xiamihttps://www.xiami.com/✕----✕✕

-表示不一定支持,✓表示部分或完全支持,✕表示尚未支持

欢迎提交插件支持更多音乐源!插件写法参考addons中的文件

更新记录

  • 2019-08-25 修复了QQ音乐、网易云音乐、酷狗音乐,新增咪咕音乐
  • 2019-08-03 修复了一些bug,屏蔽了不支持的源,目前仅百度音乐可用
  • 2019-06-13 重新增加虾米音乐高品质音乐支持,感谢群友0.0提供的API
  • 2019-06-11 v3.0预览版,代码重构,支持网易云音乐歌单和单曲下载,支持百度高品质音乐
  • 2019-04-08 发布v2.2.1版本
  • 2019-04-04 因为虾米音乐API变更,暂时屏蔽虾米搜索结果#22
  • 2019-04-02 修复#18和#21的BUG,优化显示效果,支持部分音乐源歌词和封面下载
  • 2019-03-11 开启默认支持所有音乐源,默认对搜索结果排序去重,优化显示效果,高亮搜索关键字和高品质音乐
  • 2019-02 完成部分翻译(英语、德语、日语、克罗地亚语)感谢@anomie31 @DarkLinkXXXX @terorie的帮助,目前翻译尚未完善,欢迎提交PR改进翻译
  • 2019-01-31 新增单元测试,集成发布,新增LOGO,新增小徽章,发布v2.1.0版本
  • 2019-01-28 重写一半以上代码,全面优化,发布到pip库,发布v2.0.0版本
  • 2019-01-26 支持http和socks代理,删除wget库,新增click库,发布v1.1版
  • 2019-01-25 支持百度无损音乐
  • 2019-01-24 优化交互、修复bug
  • 2019-01-22 解决Windows兼容问题,支持多线程,发布v1.0版
  • 2019-01-21 支持虾米音乐,支持去重
  • 2019-01-20 支持百度音乐
  • 2019-01-17 支持指定目录、数量、音乐源
  • 2019-01-12 QQ音乐320K失效
  • 2019-01-11 支持网易云音乐
  • 2019-01-09 完成v0.1版,支持酷狗和QQ

提Issues说明

  • **检查是否是最新的代码,检查是否是Python3.5+,检查依赖有没有安装完整**。
  • 说明使用的操作系统,例如Windows 10 x64
  • 说明Python版本,以及是否使用了pyenv等虚拟环境
  • 说明使用的命令参数、搜索关键字和出错的音乐源
  • 使用-v参数重试,说明详细的错误信息,最好有截图
  • 如果有新的思路和建议也欢迎提交

Credits 致谢

本项目受以下项目启发,参考了其中一部分思路,向这些开发者表示感谢。

用爱发电

维护不易,欢迎扫描恰饭二维码

LICENSE

MIT License