refactor(sdk): 审计 P2 卫生项清理——请求层收敛与死代码清除
- 删除旧 sdk/request.ts,全部 import 收敛到 sdk/common/request.ts(85 文件) - 注释死代码 630+ 行、裸 console.log 吞错 6 处、未使用符号 26 处清零 - bili 状态校验去重;utils DNS 预解析失败日志改 warn 带上下文 - CODE-AUDIT.md:第四节 P2 清理记录 + 第八节线索逐条复核结论(kw/kg/tx/wy parse 骨架相似实质各异,不抽公共层)
This commit is contained in:
1 parent
ecca1b8458
commit
8c02fb5c15
85 files changed
+112
-839
No files matched your search
+2
-24
@@ -1,4 +1,4 @@
|
||||
import { httpFetch } from '../request.ts'
|
||||
import { httpFetch } from '../common/request.ts'
|
||||
import { decodeKrc } from './krcDecode.ts'
|
||||
|
||||
export default {
|
||||
@@ -13,28 +13,6 @@ export default {
|
||||
}
|
||||
return parseInt(intv as unknown as string)
|
||||
},
|
||||
// getLyric(songInfo, tryNum = 0) {
|
||||
// let requestObj = httpFetch(`http://m.kugou.com/app/i/krc.php?cmd=100&keyword=${encodeURIComponent(songInfo.name)}&hash=${songInfo.hash}&timelength=${songInfo._interval || this.getIntv(songInfo.interval)}&d=0.38664927426725626`, {
|
||||
// headers: {
|
||||
// 'KG-RC': 1,
|
||||
// 'KG-THash': 'expand_search_manager.cpp:852736169:451',
|
||||
// 'User-Agent': 'KuGou2012-9020-ExpandSearchManager',
|
||||
// },
|
||||
// })
|
||||
// requestObj.promise = requestObj.promise.then(({ body, statusCode }) => {
|
||||
// if (statusCode !== 200) {
|
||||
// if (tryNum > 5) return Promise.reject(new Error('歌词获取失败'))
|
||||
// let tryRequestObj = this.getLyric(songInfo, ++tryNum)
|
||||
// requestObj.cancelHttp = tryRequestObj.cancelHttp.bind(tryRequestObj)
|
||||
// return tryRequestObj.promise
|
||||
// }
|
||||
// return {
|
||||
// lyric: body,
|
||||
// tlyric: '',
|
||||
// }
|
||||
// })
|
||||
// return requestObj
|
||||
// },
|
||||
searchLyric(name, hash, time, tryNum = 0) {
|
||||
let requestObj = httpFetch(`http://lyrics.kugou.com/search?ver=1&man=yes&client=pc&keyword=${encodeURIComponent(name)}&hash=${hash}&timelength=${time}&lrctxt=1`, {
|
||||
headers: {
|
||||
@@ -92,7 +70,7 @@ export default {
|
||||
|
||||
return requestObj
|
||||
},
|
||||
getLyric(songInfo, tryNum = 0) {
|
||||
getLyric(songInfo) {
|
||||
let requestObj = this.searchLyric(songInfo.name, songInfo.hash, songInfo._interval || this.getIntv(songInfo.interval))
|
||||
|
||||
requestObj.promise = requestObj.promise.then(result => {
|
||||
|
||||
Reference in new issue
Block a user