Skip to content
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

Empty Member Milestone Chats breaks the chat (日本語) #96

Open
FlashlightXi opened this issue Jan 12, 2023 · 0 comments · May be fixed by #97
Open

Empty Member Milestone Chats breaks the chat (日本語) #96

FlashlightXi opened this issue Jan 12, 2023 · 0 comments · May be fixed by #97

Comments

@FlashlightXi
Copy link

FlashlightXi commented Jan 12, 2023

error: TypeError: Cannot read properties of undefined (reading 'map')
    at parseMessages (youtube-chat\dist\parser.js:89:17)

どうやらparser.js 149行目のparseMessages(message)関数にundefinedを引数として入れているようでエラーが起きているみたいです。
そのmessageの変数を探していたところ、同プログラム 134 ~ 140行目に記述がありました

let message = [];
if ("message" in messageRenderer) {
    message = messageRenderer.message.runs;
}
else if ("headerSubtext" in messageRenderer) {
    message = messageRenderer.headerSubtext.runs;
}

のようになっていますが、メンバーマイルストーンのmessageRendererはこんなデータを返していました

{
  id: 'id',
  timestampUsec: '1673550636512193',
  authorExternalChannelId: 'channelId',
  headerPrimaryText: { runs: [ { text: 'Member for ' }, { text: '14' }, { text: ' months' } ] },
  headerSubtext: { simpleText: 'membership tier name' },
  
  empty: true,
  
  // メッセージがある場合、emptyキーは消え代わりにmessageキーがこのように出力されると思われる (#78 より)
  // "message": { "runs": [ { "text": "Hi" } ] },
  
  authorName: { simpleText: 'channel name' },
  authorPhoto: { thumbnails: [ [Object], [Object] ] },
  authorBadges: [
    { liveChatAuthorBadgeRenderer: [Object] },
    { liveChatAuthorBadgeRenderer: [Object] }
  ],
  contextMenuEndpoint: {
    clickTrackingParams: 'clickTrackingParams',
    commandMetadata: { webCommandMetadata: [Object] },
    liveChatItemContextMenuEndpoint: {
      params: 'params'
    }
  },
  contextMenuAccessibility: { accessibilityData: { label: 'Chat actions' } },
  trackingParams: 'trackingParams'
}

メッセージがない場合 empty: true の表記があると思われますので、その分岐を追加していただけるとありがたいです

@FlashlightXi FlashlightXi changed the title Empty Member Milestone Chats breaks the chat Empty Member Milestone Chats breaks the chat (日本語) Jan 12, 2023
@narze narze linked a pull request Jun 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant