const base = 'http://171.80.3.149:5244';
const shareCode = 'c6VNt7hG';
const pwd = 'music';
const plugins = ['zq_kw_v3-fix1.js','zq_wy_v3.js','zq_tx_v3-fix1.js','zq_kg.js','zq_mg_v3.js'];

async function downloadPlugin(name) {
  const path = '/@s/' + shareCode + '/音源/QZ-Music_v2/官方/v3/' + name;
  const resp = await fetch(base + '/api/fs/get', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ path, password: pwd })
  });
  const data = await resp.json();
  if (data.code !== 200 || !data.data?.raw_url) {
    console.log(name + ': no raw_url');
    return null;
  }
  return { name, raw_url: data.data.raw_url, size: data.data.size };
}

async function main() {
  for (const p of plugins) {
    const info = await downloadPlugin(p);
    if (info) console.log(info.name + ' -> ' + info.raw_url + ' (' + info.size + ' bytes)');
  }
}
main();
