mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 14:42:09 +08:00
添加搜索重试
This commit is contained in:
parent
f02cb72786
commit
9d0f03aadd
@ -307,7 +307,8 @@ export default {
|
|||||||
return `https://y.qq.com/n/ryqq/playlist/${id}`
|
return `https://y.qq.com/n/ryqq/playlist/${id}`
|
||||||
},
|
},
|
||||||
|
|
||||||
search(text, page, limit = 20) {
|
search(text, page, limit = 20, retryNum = 0) {
|
||||||
|
if (retryNum > 5) throw new Error('max retry')
|
||||||
return httpFetch(`http://c.y.qq.com/soso/fcgi-bin/client_music_search_songlist?page_no=${page - 1}&num_per_page=${limit}&format=json&query=${encodeURIComponent(text)}&remoteplace=txt.yqq.playlist&inCharset=utf8&outCharset=utf-8`, {
|
return httpFetch(`http://c.y.qq.com/soso/fcgi-bin/client_music_search_songlist?page_no=${page - 1}&num_per_page=${limit}&format=json&query=${encodeURIComponent(text)}&remoteplace=txt.yqq.playlist&inCharset=utf8&outCharset=utf-8`, {
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',
|
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',
|
||||||
@ -315,7 +316,7 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.promise.then(({ body }) => {
|
.promise.then(({ body }) => {
|
||||||
if (body.code != 0) throw new Error('filed')
|
if (body.code != 0) return this.search(text, page, limit, ++retryNum)
|
||||||
// console.log(body.data.list)
|
// console.log(body.data.list)
|
||||||
return {
|
return {
|
||||||
list: body.data.list.map(item => {
|
list: body.data.list.map(item => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user