关注吃喝新鲜事 优惠早知道
X扫一扫,关注吃喝微信订阅号

吃喝玩乐网官方微信订阅号:
成都吃喝玩乐网

  • 无缝对接网站,实时在线,热闹无边
  • 新鲜讯息推送,及时送达
  • 福利折扣优惠送送送
  • 微信里的吃喝玩乐
X扫一扫,关注吃喝微信服务号

吃喝玩乐网官方微信服务号:
吃喝玩乐网

  • 无缝对接网站,实时在线,热闹无边
  • 新鲜讯息推送,及时送达
  • 功能强大的福利折扣优惠活动
  • 微信里的吃喝玩乐
查看: 1269|回复: 6

[居家常备] 求个洛雪音源 标题要长 配图与内容无关

godowl
UID 941694
发表于 2024-12-20 07:52 | 显示全部楼层 来自: 北京市 新国信通信有限公司
来求个音源 洛雪几个音源失效了 找不到可以用的了

友情提示:发言及回复仅代表网友观点,不代表本站立场!

雲山
UID 136201
发表于 2024-12-20 08:30 | 显示全部楼层 来自: 四川省成都市 电信
/*!
* @Name ikun公益音源
* @description 请不要在国内平台转发, TME年终奖还没发呢, 交流群组: https://t.me/ikunshare_qun
* @version v501
* @author ikunshare
* @repository https://github.com/lxmusics/lx-music-api-server
*/

// 是否开启开发模式
const DEV_ENABLE = false
// 是否开启更新提醒
const UPDATE_ENABLE = true
// 服务端地址
const API_URL = "https://lxmusic.ikunshare.com"
// 服务端配置的请求key
const API_KEY = ``
// 音质配置(key为音源名称,不要乱填.如果你账号为VIP可以填写到hires)
// 全部的支持值: ['128k', '320k', 'flac', 'flac24bit']
const MUSIC_QUALITY = JSON.parse('{"kw":["128k","320k","flac","flac24bit"],"kg":["128k","320k","flac","flac24bit"],"tx":["128k","320k","flac","flac24bit","effect","effect_plus","master"],"wy":["128k","320k","flac","flac24bit","dolby","sky","master"],"mg":["128k","320k","flac","flac24bit"]}')
// 音源配置(默认为自动生成,可以修改为手动)
const MUSIC_SOURCE = Object.keys(MUSIC_QUALITY)
MUSIC_SOURCE.push('local')

/**
* 下面的东西就不要修改了
*/
const { EVENT_NAMES, request, on, send, utils, env, version } = globalThis.lx

// MD5值,用来检查更新
const SCRIPT_MD5 = '87070e97bb6384fe8ea87cc58f1482ef'

/**
* URL请求
*
* @param {string} url - 请求的地址
* @param {object} options - 请求的配置文件
* @return {Promise} 携带响应体的Promise对象
*/
const httpFetch = (url, options = { method: 'GET' }) => {
  return new Promise((resolve, reject) => {
    console.log('--- start --- ' + url)
    request(url, options, (err, resp) => {
      if (err) return reject(err)
      console.log('API Response: ', resp)
      resolve(resp)
    })
  })
}

/**
* Encodes the given data to base64.
*
* @param {type} data - the data to be encoded
* @return {string} the base64 encoded string
*/
const handleBase64Encode = (data) => {
  var data = utils.buffer.from(data, 'utf-8')
  return utils.buffer.bufToString(data, 'base64')
}

/**
*
* @param {string} source - 音源
* @param {object} musicInfo - 歌曲信息
* @param {string} quality - 音质
* @returns {Promise<string>} 歌曲播放链接
* @throws {Error} - 错误消息
*/
const handleGetMusicUrl = async (source, musicInfo, quality) => {
  if (source == 'local') {
    if (!musicInfo.songmid.startsWith('server_')) throw new Error('upsupported local file')
    const songId = musicInfo.songmid
    const requestBody = {
      p: songId.replace('server_', ''),
    }
    var t = 'c'
    var b = handleBase64Encode(JSON.stringify(requestBody)) /* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
    const targetUrl = `${API_URL}/local/${t}?q=${b}`
    const request = await httpFetch(targetUrl, {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
        'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`,
        'X-Request-Key': API_KEY,
      },
      follow_max: 5,
    })
    const { body } = request
    if (body.code == 0 && body.data && body.data.file) {
      var t = 'u'
      var b = handleBase64Encode(JSON.stringify(requestBody)) /* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
      return `${API_URL}/local/${t}?q=${b}`
    }
    throw new Error('404 Not Found')
  }

  const songId = musicInfo.hash ?? musicInfo.songmid

  const request = await httpFetch(`${API_URL}/url/${source}/${songId}/${quality}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`,
      'X-Request-Key': API_KEY,
    },
    follow_max: 5,
  })
  const { body } = request

  if (!body || isNaN(Number(body.code))) throw new Error('unknow error')
  if (env != 'mobile') console.groupEnd()
  switch (body.code) {
    case 0:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) success, URL: ${body.data}`)
      return body.data
    case 1:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed: ip被封禁`)
      throw new Error('block ip')
    case 2:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, ${body.msg}`)
      throw new Error('get music url failed')
    case 4:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, 远程服务器错误`)
      throw new Error('internal server error')
    case 5:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, 请求过于频繁,请休息一下吧`)
      throw new Error('too many requests')
    case 6:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, 请求参数错误`)
      throw new Error('param error')
    default:
      console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, ${body.msg ? body.msg : 'unknow error'}`)
      throw new Error(body.msg ?? 'unknow error')
  }
}

const handleGetMusicPic = async (source, musicInfo) => {
  switch (source) {
    case 'local':
      // 先从服务器检查是否有对应的类型,再响应链接
      if (!musicInfo.songmid.startsWith('server_')) throw new Error('upsupported local file')
      const songId = musicInfo.songmid
      const requestBody = {
        p: songId.replace('server_', ''),
      }
      var t = 'c'
      var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
      const targetUrl = `${API_URL}/local/${t}?q=${b}`
      const request = await httpFetch(targetUrl, {
        method: 'GET',
        headers: {
          'Content-Type': 'application/json',
          'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
        },
        follow_max: 5,
      })
      const { body } = request
      if (body.code === 0 && body.data.cover) {
        var t = 'p'
        var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
        return `${API_URL}/local/${t}?q=${b}`
      }
      throw new Error('get music pic failed')
    default:
      throw new Error('action(pic) does not support source(' + source + ')')
  }
}

const handleGetMusicLyric = async (source, musicInfo) => {
  switch (source) {
    case 'local':
      if (!musicInfo.songmid.startsWith('server_')) throw new Error('upsupported local file')
      const songId = musicInfo.songmid
      const requestBody = {
        p: songId.replace('server_', ''),
      }
      var t = 'c'
      var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
      const targetUrl = `${API_URL}/local/${t}?q=${b}`
      const request = await httpFetch(targetUrl, {
        method: 'GET',
        headers: {
          'Content-Type': 'application/json',
          'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
        },
        follow_max: 5,
      })
      const { body } = request
      if (body.code === 0 && body.data.lyric) {
        var t = 'l'
        var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
        const request2 = await httpFetch(`${API_URL}/local/${t}?q=${b}`, {
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
            'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
          },
          follow_max: 5,
        })
        if (request2.body.code === 0) {
          return {
            lyric: request2.body.data ?? "",
            tlyric: "",
            rlyric: "",
            lxlyric: ""
          }
        }
        throw new Error('get music lyric failed')
      }
      throw new Error('get music lyric failed')
    default:
      throw new Error('action(lyric) does not support source(' + source + ')')
  }
}

// 检查源脚本是否有更新
const checkUpdate = async () => {
  const request = await httpFetch(`${API_URL}/script?key=${API_KEY}&checkUpdate=${SCRIPT_MD5}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
    },
  })
  const { body } = request

  if (!body || body.code !== 0) console.log('checkUpdate failed')
  else {
    console.log('checkUpdate success')
    if (body.data != null) {
      globalThis.lx.send(lx.EVENT_NAMES.updateAlert, { log: body.data.updateMsg, updateUrl: body.data.updateUrl })
    }
  }
}

// 生成歌曲信息
const musicSources = {}
MUSIC_SOURCE.forEach(item => {
  musicSources[item] = {
    name: item,
    type: 'music',
    actions: (item == 'local') ? ['musicUrl', 'pic', 'lyric'] : ['musicUrl'],
    qualitys: (item == 'local') ? [] : MUSIC_QUALITY[item],
  }
})

// 监听 LX Music 请求事件
on(EVENT_NAMES.request, ({ action, source, info }) => {
  switch (action) {
    case 'musicUrl':
      if (env != 'mobile') {
        console.group(`Handle Action(musicUrl)`)
        console.log('source', source)
        console.log('quality', info.type)
        console.log('musicInfo', info.musicInfo)
      } else {
        console.log(`Handle Action(musicUrl)`)
        console.log('source', source)
        console.log('quality', info.type)
        console.log('musicInfo', info.musicInfo)
      }
      return handleGetMusicUrl(source, info.musicInfo, info.type)
        .then(data => Promise.resolve(data))
        .catch(err => Promise.reject(err))
    case 'pic':
      return handleGetMusicPic(source, info.musicInfo)
        .then(data => Promise.resolve(data))
        .catch(err => Promise.reject(err))
    case 'lyric':
      return handleGetMusicLyric(source, info.musicInfo)
        .then(data => Promise.resolve(data))
        .catch(err => Promise.reject(err))
    default:
      console.error(`action(${action}) not support`)
      return Promise.reject('action not support')
  }
})

// 检查更新
if (UPDATE_ENABLE) checkUpdate()
// 向 LX Music 发送初始化成功事件
send(EVENT_NAMES.inited, { status: true, openDevTools: DEV_ENABLE, sources: musicSources })

上面的保存为.js文件。导入进去。
ztms
UID 794227
发表于 2024-12-20 09:38 | 显示全部楼层 来自: 四川省成都市 电信
安卓手机可以试试我这个  通过百度网盘分享的文件:网易云音乐v9.0.0集成杜比大喇叭.apk
链接:https://pan.baidu.com/s/1g3D0kLRYe0TBE6D2NcRtSQ?pwd=ov0o
提取码:ov0o
ljlw
UID 924515
发表于 2024-12-20 09:49 | 显示全部楼层 来自: 四川省 移动数据上网公共出口
ztms 发表于 2024-12-20 09:38
安卓手机可以试试我这个  通过百度网盘分享的文件:网易云音乐v9.0.0集成杜比大喇叭.apk
链接:https://pan ...

感谢大佬。
淡然一笑1
UID 1194017
发表于 2024-12-20 14:52 来自手机 | 显示全部楼层 来自: 四川省成都市 联通
ztms 发表于 2024-12-20 09:38
安卓手机可以试试我这个&nbsp;&nbsp;通过百度网盘分享的文件:网易云音乐v9.0.0集成杜比大喇叭.apk
链接:https://pan.baidu.com/s/1g3D0kLRYe0TBE6D2NcRtSQ?pwd=ov0o
提取码:ov0o

安卓的很容易更新失效啊,添加音源还是靠谱
godowl
UID 941694
 楼主| 发表于 2024-12-20 17:29 来自手机 | 显示全部楼层 来自: 四川省成都市 电信
雲山 发表于 2024-12-20 08:30
/*!
* @Name ikun公益音源
* @description 请不要在国内平台转发, TME年终奖还没发呢, 交流群组: https://t.me/ikunshare_qun
* @version v501
* @author ikunshare
* @repository https://github.com/lxmusics/lx-music-api-server
*/

// 是否开启开发模式
const DEV_ENABLE = false
// 是否开启更新提醒
const UPDATE_ENABLE = true
// 服务端地址
const API_URL = &quot;https://lxmusic.ikunshare.com&quot;
// 服务端配置的请求key
const API_KEY = ``
// 音质配置(key为音源名称,不要乱填.如果你账号为VIP可以填写到hires)
// 全部的支持值: ['128k', '320k', 'flac', 'flac24bit']
const MUSIC_QUALITY = JSON.parse('{&quot;kw&quot;:[&quot;128k&quot;,&quot;320k&quot;,&quot;flac&quot;,&quot;flac24bit&quot;],&quot;kg&quot;:[&quot;128k&quot;,&quot;320k&quot;,&quot;flac&quot;,&quot;flac24bit&quot;],&quot;tx&quot;:[&quot;128k&quot;,&quot;320k&quot;,&quot;flac&quot;,&quot;flac24bit&quot;,&quot;effect&quot;,&quot;effect_plus&quot;,&quot;master&quot;],&quot;wy&quot;:[&quot;128k&quot;,&quot;320k&quot;,&quot;flac&quot;,&quot;flac24bit&quot;,&quot;dolby&quot;,&quot;sky&quot;,&quot;master&quot;],&quot;mg&quot;:[&quot;128k&quot;,&quot;320k&quot;,&quot;flac&quot;,&quot;flac24bit&quot;]}')
// 音源配置(默认为自动生成,可以修改为手动)
const MUSIC_SOURCE = Object.keys(MUSIC_QUALITY)
MUSIC_SOURCE.push('local')

/**
* 下面的东西就不要修改了
*/
const { EVENT_NAMES, request, on, send, utils, env, version } = globalThis.lx

// MD5值,用来检查更新
const SCRIPT_MD5 = '87070e97bb6384fe8ea87cc58f1482ef'

/**
* URL请求
*
* @param {string} url - 请求的地址
* @param {object} options - 请求的配置文件
* @return {Promise} 携带响应体的Promise对象
*/
const httpFetch = (url, options = { method: 'GET' }) =&gt; {
&nbsp;&nbsp;return new Promise((resolve, reject) =&gt; {
&nbsp; &nbsp; console.log('--- start --- ' + url)
&nbsp; &nbsp; request(url, options, (err, resp) =&gt; {
&nbsp; &nbsp;&nbsp; &nbsp;if (err) return reject(err)
&nbsp; &nbsp;&nbsp; &nbsp;console.log('API Response: ', resp)
&nbsp; &nbsp;&nbsp; &nbsp;resolve(resp)
&nbsp; &nbsp; })
&nbsp;&nbsp;})
}

/**
* Encodes the given data to base64.
*
* @param {type} data - the data to be encoded
* @return {string} the base64 encoded string
*/
const handleBase64Encode = (data) =&gt; {
&nbsp;&nbsp;var data = utils.buffer.from(data, 'utf-8')
&nbsp;&nbsp;return utils.buffer.bufToString(data, 'base64')
}

/**
*
* @param {string} source - 音源
* @param {object} musicInfo - 歌曲信息
* @param {string} quality - 音质
* @returns {Promise&lt;string&gt;} 歌曲播放链接
* @throws {Error} - 错误消息
*/
const handleGetMusicUrl = async (source, musicInfo, quality) =&gt; {
&nbsp;&nbsp;if (source == 'local') {
&nbsp; &nbsp; if (!musicInfo.songmid.startsWith('server_')) throw new Error('upsupported local file')
&nbsp; &nbsp; const songId = musicInfo.songmid
&nbsp; &nbsp; const requestBody = {
&nbsp; &nbsp;&nbsp; &nbsp;p: songId.replace('server_', ''),
&nbsp; &nbsp; }
&nbsp; &nbsp; var t = 'c'
&nbsp; &nbsp; var b = handleBase64Encode(JSON.stringify(requestBody)) /* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
&nbsp; &nbsp; const targetUrl = `${API_URL}/local/${t}?q=${b}`
&nbsp; &nbsp; const request = await httpFetch(targetUrl, {
&nbsp; &nbsp;&nbsp; &nbsp;method: 'GET',
&nbsp; &nbsp;&nbsp; &nbsp;headers: {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;'Content-Type': 'application/json',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`,
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;'X-Request-Key': API_KEY,
&nbsp; &nbsp;&nbsp; &nbsp;},
&nbsp; &nbsp;&nbsp; &nbsp;follow_max: 5,
&nbsp; &nbsp; })
&nbsp; &nbsp; const { body } = request
&nbsp; &nbsp; if (body.code == 0 &amp;&amp; body.data &amp;&amp; body.data.file) {
&nbsp; &nbsp;&nbsp; &nbsp;var t = 'u'
&nbsp; &nbsp;&nbsp; &nbsp;var b = handleBase64Encode(JSON.stringify(requestBody)) /* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
&nbsp; &nbsp;&nbsp; &nbsp;return `${API_URL}/local/${t}?q=${b}`
&nbsp; &nbsp; }
&nbsp; &nbsp; throw new Error('404 Not Found')
&nbsp;&nbsp;}

&nbsp;&nbsp;const songId = musicInfo.hash ?? musicInfo.songmid

&nbsp;&nbsp;const request = await httpFetch(`${API_URL}/url/${source}/${songId}/${quality}`, {
&nbsp; &nbsp; method: 'GET',
&nbsp; &nbsp; headers: {
&nbsp; &nbsp;&nbsp; &nbsp;'Content-Type': 'application/json',
&nbsp; &nbsp;&nbsp; &nbsp;'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`,
&nbsp; &nbsp;&nbsp; &nbsp;'X-Request-Key': API_KEY,
&nbsp; &nbsp; },
&nbsp; &nbsp; follow_max: 5,
&nbsp;&nbsp;})
&nbsp;&nbsp;const { body } = request

&nbsp;&nbsp;if (!body || isNaN(Number(body.code))) throw new Error('unknow error')
&nbsp;&nbsp;if (env != 'mobile') console.groupEnd()
&nbsp;&nbsp;switch (body.code) {
&nbsp; &nbsp; case 0:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) success, URL: ${body.data}`)
&nbsp; &nbsp;&nbsp; &nbsp;return body.data
&nbsp; &nbsp; case 1:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed: ip被封禁`)
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('block ip')
&nbsp; &nbsp; case 2:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, ${body.msg}`)
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('get music url failed')
&nbsp; &nbsp; case 4:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, 远程服务器错误`)
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('internal server error')
&nbsp; &nbsp; case 5:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, 请求过于频繁,请休息一下吧`)
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('too many requests')
&nbsp; &nbsp; case 6:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, 请求参数错误`)
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('param error')
&nbsp; &nbsp; default:
&nbsp; &nbsp;&nbsp; &nbsp;console.log(`handleGetMusicUrl(${source}_${musicInfo.songmid}, ${quality}) failed, ${body.msg ? body.msg : 'unknow error'}`)
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error(body.msg ?? 'unknow error')
&nbsp;&nbsp;}
}

const handleGetMusicPic = async (source, musicInfo) =&gt; {
&nbsp;&nbsp;switch (source) {
&nbsp; &nbsp; case 'local':
&nbsp; &nbsp;&nbsp; &nbsp;// 先从服务器检查是否有对应的类型,再响应链接
&nbsp; &nbsp;&nbsp; &nbsp;if (!musicInfo.songmid.startsWith('server_')) throw new Error('upsupported local file')
&nbsp; &nbsp;&nbsp; &nbsp;const songId = musicInfo.songmid
&nbsp; &nbsp;&nbsp; &nbsp;const requestBody = {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;p: songId.replace('server_', ''),
&nbsp; &nbsp;&nbsp; &nbsp;}
&nbsp; &nbsp;&nbsp; &nbsp;var t = 'c'
&nbsp; &nbsp;&nbsp; &nbsp;var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
&nbsp; &nbsp;&nbsp; &nbsp;const targetUrl = `${API_URL}/local/${t}?q=${b}`
&nbsp; &nbsp;&nbsp; &nbsp;const request = await httpFetch(targetUrl, {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;method: 'GET',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;headers: {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 'Content-Type': 'application/json',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;},
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;follow_max: 5,
&nbsp; &nbsp;&nbsp; &nbsp;})
&nbsp; &nbsp;&nbsp; &nbsp;const { body } = request
&nbsp; &nbsp;&nbsp; &nbsp;if (body.code === 0 &amp;&amp; body.data.cover) {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var t = 'p'
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;return `${API_URL}/local/${t}?q=${b}`
&nbsp; &nbsp;&nbsp; &nbsp;}
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('get music pic failed')
&nbsp; &nbsp; default:
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('action(pic) does not support source(' + source + ')')
&nbsp;&nbsp;}
}

const handleGetMusicLyric = async (source, musicInfo) =&gt; {
&nbsp;&nbsp;switch (source) {
&nbsp; &nbsp; case 'local':
&nbsp; &nbsp;&nbsp; &nbsp;if (!musicInfo.songmid.startsWith('server_')) throw new Error('upsupported local file')
&nbsp; &nbsp;&nbsp; &nbsp;const songId = musicInfo.songmid
&nbsp; &nbsp;&nbsp; &nbsp;const requestBody = {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;p: songId.replace('server_', ''),
&nbsp; &nbsp;&nbsp; &nbsp;}
&nbsp; &nbsp;&nbsp; &nbsp;var t = 'c'
&nbsp; &nbsp;&nbsp; &nbsp;var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
&nbsp; &nbsp;&nbsp; &nbsp;const targetUrl = `${API_URL}/local/${t}?q=${b}`
&nbsp; &nbsp;&nbsp; &nbsp;const request = await httpFetch(targetUrl, {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;method: 'GET',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;headers: {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 'Content-Type': 'application/json',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;},
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;follow_max: 5,
&nbsp; &nbsp;&nbsp; &nbsp;})
&nbsp; &nbsp;&nbsp; &nbsp;const { body } = request
&nbsp; &nbsp;&nbsp; &nbsp;if (body.code === 0 &amp;&amp; body.data.lyric) {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var t = 'l'
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var b = handleBase64Encode(JSON.stringify(requestBody))/* url safe*/.replace(/\+/g, '-').replace(/\//g, '_')
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;const request2 = await httpFetch(`${API_URL}/local/${t}?q=${b}`, {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; method: 'GET',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; headers: {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;'Content-Type': 'application/json',
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; },
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; follow_max: 5,
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;})
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (request2.body.code === 0) {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; return {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;lyric: request2.body.data ?? &quot;&quot;,
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;tlyric: &quot;&quot;,
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;rlyric: &quot;&quot;,
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;lxlyric: &quot;&quot;
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; }
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;throw new Error('get music lyric failed')
&nbsp; &nbsp;&nbsp; &nbsp;}
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('get music lyric failed')
&nbsp; &nbsp; default:
&nbsp; &nbsp;&nbsp; &nbsp;throw new Error('action(lyric) does not support source(' + source + ')')
&nbsp;&nbsp;}
}

// 检查源脚本是否有更新
const checkUpdate = async () =&gt; {
&nbsp;&nbsp;const request = await httpFetch(`${API_URL}/script?key=${API_KEY}&amp;checkUpdate=${SCRIPT_MD5}`, {
&nbsp; &nbsp; method: 'GET',
&nbsp; &nbsp; headers: {
&nbsp; &nbsp;&nbsp; &nbsp;'Content-Type': 'application/json',
&nbsp; &nbsp;&nbsp; &nbsp;'User-Agent': `${env ? `lx-music-${env}/${version}` : `lx-music-request/${version}`}`
&nbsp; &nbsp; },
&nbsp;&nbsp;})
&nbsp;&nbsp;const { body } = request

&nbsp;&nbsp;if (!body || body.code !== 0) console.log('checkUpdate failed')
&nbsp;&nbsp;else {
&nbsp; &nbsp; console.log('checkUpdate success')
&nbsp; &nbsp; if (body.data != null) {
&nbsp; &nbsp;&nbsp; &nbsp;globalThis.lx.send(lx.EVENT_NAMES.updateAlert, { log: body.data.updateMsg, updateUrl: body.data.updateUrl })
&nbsp; &nbsp; }
&nbsp;&nbsp;}
}

// 生成歌曲信息
const musicSources = {}
MUSIC_SOURCE.forEach(item =&gt; {
&nbsp;&nbsp;musicSources[item] = {
&nbsp; &nbsp; name: item,
&nbsp; &nbsp; type: 'music',
&nbsp; &nbsp; actions: (item == 'local') ? ['musicUrl', 'pic', 'lyric'] : ['musicUrl'],
&nbsp; &nbsp; qualitys: (item == 'local') ? [] : MUSIC_QUALITY[item],
&nbsp;&nbsp;}
})

// 监听 LX Music 请求事件
on(EVENT_NAMES.request, ({ action, source, info }) =&gt; {
&nbsp;&nbsp;switch (action) {
&nbsp; &nbsp; case 'musicUrl':
&nbsp; &nbsp;&nbsp; &nbsp;if (env != 'mobile') {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.group(`Handle Action(musicUrl)`)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log('source', source)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log('quality', info.type)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log('musicInfo', info.musicInfo)
&nbsp; &nbsp;&nbsp; &nbsp;} else {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log(`Handle Action(musicUrl)`)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log('source', source)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log('quality', info.type)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;console.log('musicInfo', info.musicInfo)
&nbsp; &nbsp;&nbsp; &nbsp;}
&nbsp; &nbsp;&nbsp; &nbsp;return handleGetMusicUrl(source, info.musicInfo, info.type)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;.then(data =&gt; Promise.resolve(data))
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;.catch(err =&gt; Promise.reject(err))
&nbsp; &nbsp; case 'pic':
&nbsp; &nbsp;&nbsp; &nbsp;return handleGetMusicPic(source, info.musicInfo)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;.then(data =&gt; Promise.resolve(data))
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;.catch(err =&gt; Promise.reject(err))
&nbsp; &nbsp; case 'lyric':
&nbsp; &nbsp;&nbsp; &nbsp;return handleGetMusicLyric(source, info.musicInfo)
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;.then(data =&gt; Promise.resolve(data))
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;.catch(err =&gt; Promise.reject(err))
&nbsp; &nbsp; default:
&nbsp; &nbsp;&nbsp; &nbsp;console.error(`action(${action}) not support`)
&nbsp; &nbsp;&nbsp; &nbsp;return Promise.reject('action not support')
&nbsp;&nbsp;}
})

// 检查更新
if (UPDATE_ENABLE) checkUpdate()
// 向 LX Music 发送初始化成功事件
send(EVENT_NAMES.inited, { status: true, openDevTools: DEV_ENABLE, sources: musicSources })

上面的保存为.js文件。导入进去。

感谢 现在就搞搞
godowl
UID 941694
 楼主| 发表于 2024-12-20 18:15 | 显示全部楼层 来自: 四川省成都市 电信
ztms 发表于 2024-12-20 09:38
安卓手机可以试试我这个  通过百度网盘分享的文件:网易云音乐v9.0.0集成杜比大喇叭.apk
链接:https://pan ...

谢谢!主要用来下载的。需要电脑上用
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

99元抢购蜀仁口腔 超声波舒适洁牙套餐

99.00

蜀仁洁牙福利来了! 成人超声波全口舒适化洁牙仅需99元!

去看看

老罗贴膜团购返场 700起到手价

49.00

新一季的老罗贴膜团购来了,前档+后档+侧窗实际到手价700起

去看看

金、银质感吃喝车标以及贴纸款车标上新 申购中

5.00

52CH车友会-车标金银、贴纸上新,顺丰直达

去看看

返回顶部 NewT 快速回复 返回列表 QQ