Skip to content

Commit

Permalink
Merge pull request #10 from alley-rs/dev
Browse files Browse the repository at this point in the history
fix(douyu): 个别房间在个别时间段可能解析失败, 引起页面状态不更新
  • Loading branch information
thep0y authored Aug 29, 2024
2 parents 3de2118 + 1ece986 commit 8f51e10
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/parser/douyu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ class Douyu {
signFunc = eval(ub98484234 + matchResult[0] + ub98484234Call) as string;
}
}

// FIXME: signFunc 为空很奇怪, 需要进一步修复
if (!signFunc) {
return Error(`此房间未获取到 signFunc, 解析失败: ${this.roomID}`);
}

const v = signFunc.match(/\w{12}/)!;

const md5 = await computeMD5(`${this.finalRoomID}${did}${ts}${v[0]}`);
Expand Down Expand Up @@ -168,7 +174,12 @@ class Douyu {
}
}

this.signFunc = await this.matchSignFunc(html);
const signFunc = await this.matchSignFunc(html);
if (signFunc instanceof Error) {
return signFunc;
}

this.signFunc = signFunc;

const anchor = html.match(/<div class="Title-anchorName" title="(.+?)">/);
this.anchor = anchor![1];
Expand Down

0 comments on commit 8f51e10

Please sign in to comment.