-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
有没有可能添加通过长度判断音源的功能? #372
Comments
#180 |
我的想法是能不能挑前5个结果,然后判断这5个当中有没有时长相差5s之内的结果,如果没有就播放第一条,如果有就播放第一个符合长度相差5s之内的结果。是否可行? |
在 255fd52 给除 youtube 外的提供平台都加了 formatter 用来格式化 歌名 / 歌手 / 专辑 / 时长 字段,方便比较 不过不是所有平台的搜索结果都有时长字段 我个人的意见是做这个筛选意义不大,各个平台都会不断优化他们的搜索结果
如果你需要可以自己改 select.js 按照你的需求,代码实现如下 module.exports = (list, info) => {
const {duration} = info
const song = list
.slice(0, 5) // 挑前5个结果
.find(song => song.duration && Math.abs(song.duration - duration) < 5 * 1e3) // 第一个时长相差5s (5000ms) 之内的结果
if (song)
return song
else
return list[0] // 没有就播放第一条
} |
有道理!感谢回复! |
您好基于您的项目,写了一个PHP项目,https://music.yaode.xyz/query?id=72569,按照这里提供的思路,匹配歌曲歌手名,歌曲长度提高精度,咪咕时长字段没有找到,虾米是 .length 百度是 .duration,后续项目优化后开源,再次感谢 |
@Dreamiva 百度 UnblockNeteaseMusic/src/provider/baidu.js Lines 16 to 17 in 155f834
{
"bitrate_fee": "{\"0\":\"129|-1\",\"1\":\"-1|-1\"}",
"weight": "99",
"songname": "发如雪",
"resource_type": "0",
"songid": "1147070",
"has_mv": "0",
"copy_type": 0,
"yyr_artist": "0",
"resource_type_ext": "0",
"artistname": "周杰伦",
"info": "",
"resource_provider": "1",
"control": "1100000000",
"encrypted_songid": "56061180be0958414d02L"
} 虾米 UnblockNeteaseMusic/src/provider/xiami.js Lines 68 to 70 in 155f834
{
"song_id": 376037,
"song_name": "发如雪",
"album_id": 6643,
"album_name": "十一月的萧邦",
"album_logo": "http://pic.xiami.net/images/album/img1/376501/66431503376502.jpg",
"artist_id": 1260,
"artist_name": "周杰伦",
"artist_logo": "http://pic.xiami.net/images/artistlogo/36/15162027033536.jpg",
"listen_file": "",
"demo": 0,
"need_pay_flag": 0,
"lyric": "http://img.xiami.net/lyric/37/376037_1505118871_3899.trc",
"purview_roles": [
{
"quality": "s",
"operation_list": [
{
"purpose": 1,
"upgrade_role": 1
},
{
"purpose": 2,
"upgrade_role": 1
}
]
},
{
"quality": "h",
"operation_list": [
{
"purpose": 1,
"upgrade_role": 1
},
{
"purpose": 2,
"upgrade_role": 1
}
]
},
{
"quality": "l",
"operation_list": [
{
"purpose": 1,
"upgrade_role": 1
},
{
"purpose": 2,
"upgrade_role": 1
}
]
},
{
"quality": "f",
"operation_list": [
{
"purpose": 1,
"upgrade_role": 1
},
{
"purpose": 2,
"upgrade_role": 1
}
]
},
{
"quality": "e",
"operation_list": [
{
"purpose": 1,
"upgrade_role": 1
},
{
"purpose": 2,
"upgrade_role": 1
}
]
}
],
"is_play": 0,
"play_counts": 0,
"singer": ""
} 有更好的 api 可以分享一下多谢 |
百度可以直接访问 虾米需要令牌 你之前的源码里有获取方式 |
有时候碰到好多首歌都叫同一个名字,正好变灰的那首歌就被替换为了另一首同名的歌曲播放。
我想了一下,能不能在某些情况下通过歌曲的长度判断是不是找对了。
不过我没读过代码,不确定目前的实现方法能否添加这一功能。
The text was updated successfully, but these errors were encountered: