getSongUrl改为返回url
This commit is contained in:
11
index.html
11
index.html
@@ -270,8 +270,15 @@
|
|||||||
return { results: [], total: 0 };
|
return { results: [], total: 0 };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getSongUrl: (id, source, br = '320k') => {
|
getSongUrl:async (id, source, br = '320k') => {
|
||||||
return `${API_BASE}?source=${source}&id=${id}&type=url&br=${br}`;
|
try {
|
||||||
|
const res = await fetch(`${API_BASE}?source=${source}&id=${id}&type=url&br=${br}`);
|
||||||
|
const data = await res.json();
|
||||||
|
return data.url;
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Get song url failed", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getPicUrl: (id, source) => {
|
getPicUrl: (id, source) => {
|
||||||
return `${API_BASE}?source=${source}&id=${id}&type=pic`;
|
return `${API_BASE}?source=${source}&id=${id}&type=pic`;
|
||||||
|
|||||||
Reference in New Issue
Block a user