Skip to content

Commit

Permalink
Add some safety to summary handling
Browse files Browse the repository at this point in the history
  • Loading branch information
FlaminSarge committed Nov 2, 2024
1 parent f1c56c1 commit 7ef9437
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ts/chat-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const parseChatSummary = (renderer: Ytc.AddChatItem, isEphemeral: boolean | unde
const baseRenderer = renderer.liveChatBannerChatSummaryRenderer!;
const runs = parseMessageRuns(renderer.liveChatBannerChatSummaryRenderer?.chatSummary.runs);
const splitRuns = splitRunsByNewline(runs, 2);
if (splitRuns.length < 3) {
// YT probably changed the format, refuse to do anything to avoid breaking
return;
}
const subheader = splitRuns[1].map(run => {
if (run.type === 'text') {
return { type: 'link', text: run.text, url: 'https://support.google.com/youtube/thread/18138167?hl=en&msgid=284199217' } as Ytc.ParsedLinkRun;
Expand Down

0 comments on commit 7ef9437

Please sign in to comment.