Skip to content

Commit

Permalink
feat(provider/pyncmd): migrate to new API
Browse files Browse the repository at this point in the history
Fixes: #1369

Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Mar 14, 2024
1 parent 787f93a commit 2bc37f7
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/provider/pyncmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ const { getManagedCacheStorage } = require('../cache');

const track = (info) => {
const url =
'https://csm.sayqz.com/api/?type=apiSongUrlV1&id=' +
'https://music.gdstudio.xyz/api.php?types=url&source=netease&id=' +
info.id +
'&level=' +
['hires', 'exhigh'].slice(
'&br=' +
['999', '320'].slice(
select.ENABLE_FLAC ? 0 : 1,
select.ENABLE_FLAC ? 1 : 2
);
Expand All @@ -17,15 +17,11 @@ const track = (info) => {
if (
jsonBody &&
typeof jsonBody === 'object' &&
'code' in jsonBody &&
jsonBody.code !== 200
(!'url') in jsonBody
)
return Promise.reject();

const matched = jsonBody.data.find((song) => song.id === info.id);
if (matched && matched.url) return matched.url;

return Promise.reject();
return jsonBody.br > 0 ? jsonBody.url : Promise.reject();
});
};

Expand Down

0 comments on commit 2bc37f7

Please sign in to comment.