Spaces:
Paused
Paused
File size: 1,376 Bytes
5ed446f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
import config from "../../config.js"
import { get_song_url } from "./song.js"
import { changeUrlQuery } from "./util.js"
const get_playlist = async (id, cookie = '') => {
const data = {
type: 1,
utf8: 1,
disstid: id,
loginUin: 0,
format: 'json'
}
const headers = {
Referer: 'https://y.qq.com/n/yqq/playlist',
}
const url = changeUrlQuery(data, 'http://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg')
let result = await fetch(url, { headers });
result = await result.json()
result = result.cdlist[0].songlist
let jsonp
if (config.OVERSEAS) {
const ids = result.map(song => song.songmid)
jsonp = await get_song_url(ids.join(','))
}
const res = await Promise.all(result.map(async song => {
let song_info = {
author: song.singer.reduce((i, v) => ((i ? i + " / " : i) + v.name), ''),
title: song.songname,
pic: `https://y.gtimg.cn/music/photo_new/T002R300x300M000${song.albummid}.jpg`,
url: config.OVERSEAS ? '' : song.songmid,
lrc: song.songmid,
songmid: song.songmid,
}
return song_info
}));
if (config.OVERSEAS) res[0].url = jsonp
return res;
}
// const res = await get_playlist('7326220405')
// console.log(res)
export { get_playlist }
|