GithubHelp home page GithubHelp logo

superheroff / musicapi Goto Github PK

View Code? Open in Web Editor NEW
82.0 1.0 24.0 547 KB

qq、酷狗、网易云、酷我音乐api

Home Page: https://www.app966.cn/music/

License: MIT License

Python 83.19% JavaScript 16.81%
kugou python qqmusic kuwo musicapi wyy

musicapi's Introduction

前言

  • 做这个的初衷就是Meting这个项目不稳定且不能满足自己的需求所以才有的这个项目
  • 我的主要用途是构建博客的歌单列表,所以此项目只是以我博客的需求做的接口
  • 目前已支持酷狗、网易、QQ、酷我音乐
  • 浏览我的歌单查看效果

如何添加COOKIE以及COOKIE有何作用

  • MusicApi_set_cookie此方法添加COOKIE
  • 如果你有会员的情况下是可以下载或试听会员音乐的(注:禁止商业用途)

如何使用

  1. 下载本项目到本地
git clone https://github.com/Superheroff/musicapi.git
  1. 安装环境依赖
pip install -r requirements.txt
  1. 运行项目
python main.py

请求示例

  • 获取歌单列表信息
  • 请求地址:http://127.0.0.1:7878
  • 路径:/music/songlist
  • 请求方式:POST,GET
  • 酷狗音乐示例:http://127.0.0.1:7878/music/songlist?server=kugou&id=6222311
  • 网易云音乐示例:http://127.0.0.1:7878/music/songlist?server=wyy&id=7480897649
  • QQ音乐示例:http://127.0.0.1:7878/music/songlist?server=qqmusic&id=8672698451
  • 酷我音乐示例:http://127.0.0.1:7878/music/songlist?server=kuwo&id=3563672431
  • 酷我获取推荐歌单列表示例:http://127.0.0.1:7878/kuwo/random_music_list
参数名 参数类型 参数描述 参数示例
server string 音乐平台 kugou,wyy,qqmusic,kuwo
id string 歌单ID 6222311,7480897649,8672698451,3563672431

响应示例

[
  {
    "author": "小霞、海洋Bo",
    "lrc": "http://127.0.0.1:7878/kugou/lrc/2E6D88A0CA2290BA32B614FC9C7EA43B.lrc",
    "music_id": "2E6D88A0CA2290BA32B614FC9C7EA43B",
    "pic": "http://imge.kugou.com/stdmusic/20230607/20230607152301805906.jpg",
    "title": "向云端",
    "url": "http://127.0.0.1:7878/kugou/2E6D88A0CA2290BA32B614FC9C7EA43B"
  },
  {
    "author": "张叶蕾",
    "lrc": "http://127.0.0.1:7878/wyy/lrc/2152040455.lrc",
    "music_id": "2152040455",
    "pic": "https://p2.music.126.net/zqd0535UOc3EDJvFf0Ymjw==/109951169555226745.jpg",
    "title": "爱你",
    "url": "http://127.0.0.1:7878/wyy/2152040455"
  },
  {
    "author": "任素汐",
    "lrc": "http://127.0.0.1:7878/qqmusic/lrc/001D51640M6ZeR.lrc",
    "music_id": "001D51640M6ZeR",
    "pic": "https://y.qq.com/music/photo_new/T002R300x300M00000003uSK0ttEuV.jpg",
    "title": "王招君 (你看你拉住我的模样)",
    "url": "http://127.0.0.1:7878/qqmusic/001D51640M6ZeR"
  },
  {
    "author": "杨宗纬&宝石Gem&王宇宙Leto",
    "lrc": "http://127.0.0.1:7878/kuwo/lrc/377413145.lrc",
    "music_id": "377413145",
    "pic": "https://img2.kuwo.cn/star/albumcover/500/s3s52/26/4134677797.png",
    "title": "若月亮没来(Live)",
    "url": "http://127.0.0.1:7878/kuwo/377413145"
  }
]
参数名 参数类型 参数描述
author string 作者
lrc string 歌词地址(待解析)
pic string 歌曲封面
title string 歌曲名
url string 歌曲地址(待解析)
music_id string 音乐ID

声明

  • 本源码仅限用于学习交流,请勿用于商业用途,非法使用与作者无关
  • 如有侵权请联系我删除
  • 学习交流QQ群:816017833

musicapi's People

Contributors

superheroff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

musicapi's Issues

请求500

在win11下运行
已经安装依赖
log如下:
[2024-07-06 22:26:57,258] ERROR in app: Exception on /music/songlist [GET] Traceback (most recent call last): File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) ^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\Desktop\存放各类代码\musicapi\main.py", line 99, in music_songlist music_info = musicapi.MusicApi_kuwo(t_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\Desktop\存放各类代码\musicapi\musicapi.py", line 306, in __init__ self.headers["Secret"] = MusicApi_kuwo_sign().get_Secret(self.cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\Desktop\存放各类代码\musicapi\app.py", line 112, in get_Secret return self.kuwojs.call('get_Secret', cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_abstract_runtime_context.py", line 37, in call return self._call(name, *args) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 92, in _call return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 78, in _eval return self.exec_(code) ^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_abstract_runtime_context.py", line 18, in exec_ return self._exec_(source) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 88, in _exec_ return self._extract_result(output) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 167, in _extract_result raise ProgramError(value) execjs._exceptions.ProgramError: SyntaxError: 缺少 ';' 127.0.0.1 - - [2024-07-06 22:26:57] "GET /music/songlist?server=wyy&id=4925702668 HTTP/1.1" 500 433 0.498082 [2024-07-06 22:28:44,431] ERROR in app: Exception on /music/songlist [GET] Traceback (most recent call last): File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) ^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\Desktop\存放各类代码\musicapi\main.py", line 99, in music_songlist music_info = musicapi.MusicApi_kuwo(t_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\Desktop\存放各类代码\musicapi\musicapi.py", line 306, in __init__ self.headers["Secret"] = MusicApi_kuwo_sign().get_Secret(self.cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\Desktop\存放各类代码\musicapi\app.py", line 112, in get_Secret return self.kuwojs.call('get_Secret', cookie) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_abstract_runtime_context.py", line 37, in call return self._call(name, *args) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 92, in _call return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 78, in _eval return self.exec_(code) ^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_abstract_runtime_context.py", line 18, in exec_ return self._exec_(source) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 88, in _exec_ return self._extract_result(output) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\p8877\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\execjs\_external_runtime.py", line 167, in _extract_result raise ProgramError(value) execjs._exceptions.ProgramError: SyntaxError: 缺少 ';' 127.0.0.1 - - [2024-07-06 22:28:44] "GET /music/songlist?server=wyy&id=4925702668 HTTP/1.1" 500 433 0.083369

返回是这样的(看起来像html?):
`
<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

` 辛苦看下,谢谢 @Superheroff

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.