Skip to content

Commit

Permalink
initial commit, v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
listen1 committed Jan 17, 2019
0 parents commit aa4b9d3
Show file tree
Hide file tree
Showing 37 changed files with 4,400 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": ["env"],
"plugins": ["babel-plugin-add-module-exports"],
"env": {
"test": {
"plugins": [
["istanbul"]
]
}
}
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = LF
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "airbnb-base",
"rules": {
"camelcase":"off",
"import/named": "off"
}
}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Remove some common IDE working directories
.idea
.vscode

.DS_Store

dist/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v6.10
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2019 Listen 1

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# listen1-api

listen1音乐资源API库,可运行在 Nodejs 和 浏览器环境(限chrome extension 或 electron)

## 特性

* 集成网易,QQ,虾米,酷狗,酷我,Bilibili平台的音乐资源API
* 支持获取热门歌单,歌手歌单,专辑歌单
* 支持搜索歌曲
* 支持获取歌曲歌词信息
* 支持获取歌曲的播放地址

## 编译
```
$ git clone git@github.com:listen1/listen1-api.git
$ cd listen1-api
$ yarn install
$ yarn build
```
编译后文件在dist目录下,`listen1-api.js``listen1-api.min.js`

## 安装
浏览器环境
```html
<script src="listen1-api.min.js"></script>
<script>
console.log(listen1Api);
</script>
```
Nodejs环境
```javascript
const listen1Api = require('./listen1-api.min');
```

## 开始使用 (nodejs 环境)

下载压缩版本,或dist目录下的`listen1-api.min.js`到本地目录

```javascript
const listen1Api = require('./listen1-api.min');
const platform = 'netease';
// 获取网易平台的热门歌单列表
const url = '/show_playlist?source='+platform;

listen1Api.apiGet(url).then((data) => {
console.log(data);
});
```

## 文档
https://listen1.github.io/listen1-api

## 项目技术
* 使用[webpack-library-starter](https://github.com/krasimir/webpack-library-starter.git)模板建立项目。
* 基于Webpack 4打包。
* ES6 语法。
* 导出[umd](https://github.com/umdjs/umd)格式的包,支持在浏览器环境和nodejs环境运行。
* ES6 测试基于 [Mocha](http://mochajs.org/)[Chai](http://chaijs.com/)
* 使用[ESLint](http://eslint.org/)进行语法检查。

## 开发使用

1. 编译生成
* 运行 `yarn install` (推荐) 或 `npm install` ,安装依赖包。
* 运行 `yarn build``npm run build` 来生成压缩版本的库文件。
2. 开发者模式
* 运行 `yarn dev``npm run dev` 安装依赖包。生成一个非压缩版本的库文件并且在文件变化时自动重新编译。
3. 运行测试
* 运行 `yarn test``npm run test`

## 常用命令

* `yarn build` or `npm run build` - 在dist目录下编译生成正式版的库文件。
* `yarn dev` or `npm run dev` - 编译生成dev版本的库并实时更新。
* `yarn test` or `npm run test` - 运行测试。
* `yarn test:watch` or `npm run test:watch` - 在watch模式运行测试。
Empty file added docs/.nojekyll
Empty file.
63 changes: 63 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# listen1-api

listen1音乐资源API库,可运行在 Nodejs 和 浏览器环境(限chrome extension 或 electron)

## 特性

* 集成网易,QQ,虾米,酷狗,酷我,Bilibili平台的音乐资源API
* 支持获取热门歌单,歌手歌单,专辑歌单
* 支持搜索歌曲
* 支持获取歌曲歌词信息
* 支持获取歌曲的播放地址

## 编译
```
$ git clone git@github.com:listen1/listen1-api.git
$ cd listen1-api
$ yarn install
$ yarn build
```
编译后文件在dist目录下,`listen1-api.js``listen1-api.min.js`

## 安装
浏览器环境
```html
<script src="listen1-api.min.js"></script>
<script>
console.log(listen1Api);
</script>
```
Nodejs环境
```javascript
const listen1Api = require('./listen1-api.min');
```

## 开始使用 (nodejs 环境)

下载压缩版本,或dist目录下的`listen1-api.min.js`到本地目录

```javascript
const listen1Api = require('./listen1-api.min');
const platform = 'netease';
// 获取网易平台的热门歌单列表
const url = '/show_playlist?source='+platform;

listen1Api.apiGet(url).then((data) => {
console.log(data);
});
```

## 项目技术
* 使用[webpack-library-starter](https://github.com/krasimir/webpack-library-starter.git)模板建立项目。
* 基于Webpack 4打包。
* ES6 语法。
* 导出[umd](https://github.com/umdjs/umd)格式的包,支持在浏览器环境和nodejs环境运行。
* ES6 测试基于 [Mocha](http://mochajs.org/)[Chai](http://chaijs.com/)
* 使用[ESLint](http://eslint.org/)进行语法检查。

## 常用命令

* `yarn build` or `npm run build` - 在dist目录下编译生成正式版的库文件。
* `yarn dev` or `npm run dev` - 编译生成dev版本的库并实时更新。
* `yarn test` or `npm run test` - 运行测试。
* `yarn test:watch` or `npm run test:watch` - 在watch模式运行测试。
10 changes: 10 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- 开始使用
- [快速开始](quickstart.md)

- 参考
- [API](api.md)
- [开发指南](developer.md)

- [关于](about.md)
- [致谢](thanks.md)
- [版本更新](changelog.md)
28 changes: 28 additions & 0 deletions docs/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 关于

当前版本: 1.0.0

[listen-api](https://github.com/listen1/listen1-api) 是Listen1项目的一部分,主要提供其它项目访问音乐资源的API支持。



## 联系方式
* 项目文档主页: https://listen1.github.io/listen1-api
* Github: https://github.com/listen1/listen1-api
* 联系邮箱:githublisten1@gmail.com


## Listen1 相关项目

[listen1/listen1](https://github.com/listen1/listen1): 最初的网页版播放器,使用Python开发Web服务器。可以直接在服务器运行,也可使用打包的Windows版和Mac版在本地运行Web服务器

[listen1/listen1_chrome_extension](https://github.com/listen1/listen1_chrome_extension): Chrome和Firefox插件版

[listen1/listen1_desktop](https://github.com/listen1/listen1_desktop): Windows,Mac,Linux桌面版。使用Electron框架,基于Listen 1 Chrome插件版JS库开发

## 本文档生成工具

[docsify](https://docsify.js.org/#/)

## 开源协议
MIT
Loading

0 comments on commit aa4b9d3

Please sign in to comment.