Compare commits

..
2 Commits
Author SHA1 Message Date
dengtongyu e778ec3f66 feat:更新 2023-11-10 17:11:09 +08:00
dengtongyu 32922bbf4b 更新api 2020-11-23 15:00:07 +08:00
6 changed files with 31 additions and 13 deletions

No files matched your search

+3
View File
@@ -19,3 +19,6 @@
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
glass-player.zip
package-lock.json
Executable
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
echo "正在打包..."
npm run build
zip -r -q ./glass-player.zip ./build/*
echo "打包完成!"
+7 -8
View File
@@ -3,15 +3,14 @@
"version": "2.1.2", "version": "2.1.2",
"private": true, "private": true,
"proxy": { "proxy": {
"/netease/*": { "/music": {
"target": "https://glassplayer.dengtongyu.com", "target": "https://api.dengtongyu.com",
"secure": true, "secure": true,
"changeOrigin": true "changeOrigin": true,
}, "headers": {
"/kugou/*": { "Origin": "https://glassplayer.dengtongyu.com",
"target": "https://glassplayer.dengtongyu.com", "Referer": "https://glassplayer.dengtongyu.com/"
"secure": true, }
"changeOrigin": true
} }
}, },
"dependencies": { "dependencies": {
+4 -1
View File
@@ -1,7 +1,7 @@
import { urlFetch, parseLyric} from './Util'; import { urlFetch, parseLyric} from './Util';
//const host = 'https://node.dengtongyu.com'; //const host = 'https://node.dengtongyu.com';
const host = '/kugou'; const host = 'https://api.dengtongyu.com/music/kugou';
const searchUrl = host + '/songSearch'; const searchUrl = host + '/songSearch';
@@ -17,6 +17,9 @@ let getKugouSearchSongList = async function(keyWord,page,size) {
let response = await urlFetch(url); let response = await urlFetch(url);
try { try {
if(!response) {
return Promise.reject("返回数据为空");
}
let data = await response.json(); let data = await response.json();
//console.log(data) //console.log(data)
let songs = {}; let songs = {};
+3 -3
View File
@@ -1,10 +1,10 @@
import { urlFetch, parseLyric} from './Util'; import { urlFetch, parseLyric} from './Util';
const host = '/netease'; const host = 'https://api.dengtongyu.com/music/netease';
const searchUrl = host + '/search'; const searchUrl = host + '/search';
const rankUrl = host + '/top/list'; const rankUrl = host + '/playlist/detail';
const songDetailUrl = host + '/song/detail'; const songDetailUrl = host + '/song/detail';
@@ -51,7 +51,7 @@ let getNeteaseSearchSongList = async function(keyWord, page, size) {
} }
let getNeteaseHotSongList = async function() { let getNeteaseHotSongList = async function() {
let url = rankUrl + '?idx=1'; let url = rankUrl + '?id=3778678';
let response = await urlFetch(url); let response = await urlFetch(url);
try { try {
let data = await response.json(); let data = await response.json();
+8 -1
View File
@@ -4,7 +4,14 @@ let urlFetch = async function (url) {
if(isFetching) return Promise.reject('您点太快了!'); if(isFetching) return Promise.reject('您点太快了!');
isFetching = true; isFetching = true;
let result = await fetch(url) let result = null;
try {
result = await fetch(url)
}
catch (error){
isFetching = false;
}
isFetching = false; isFetching = false;
return result; return result;
} }