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

feat(LiveChatPaidMessage): Parse headerOverlayImage and lowerBumper #851

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

jonz94
Copy link
Contributor

@jonz94 jonz94 commented Dec 19, 2024

When a viewer donates for the 1st, 3rd, 5th, 10th, or 20th time, there will be a special type of LiveChatPaidMessage that includes an animated image in the header, followed by a bumper text message.

Example RawNode data:

{
  "liveChatPaidMessageRenderer": {
    "id": "ChwKGkNNLW5qY3lHcVlvREZUWER3Z1FkcHY4MEhn",
    "timestampUsec": "1734240867193101",
    "authorName": {
      "simpleText": "Alice Phi - 小ㄈㄞ"
    },
    "authorPhoto": {
      "thumbnails": [
        {
          "url": "https://yt4.ggpht.com/A-kvvyBXNbkhlBQPKwkVqBD1dYoG5l4licWKpSYseFMcYHsK8kpnTGpGBPpT6SoT_xmI3RRExg=s32-c-k-c0x00ffffff-no-rj",
          "width": 32,
          "height": 32
        },
        {
          "url": "https://yt4.ggpht.com/A-kvvyBXNbkhlBQPKwkVqBD1dYoG5l4licWKpSYseFMcYHsK8kpnTGpGBPpT6SoT_xmI3RRExg=s64-c-k-c0x00ffffff-no-rj",
          "width": 64,
          "height": 64
        }
      ]
    },
    "purchaseAmountText": {
      "simpleText": "NT$7,500.00"
    },
    "message": {
      "runs": [
        {
          "text": "只要巧克力就好唷 也不用累積保底 最多抽到最多5次巧克力就可以停囉"
        }
      ]
    },
    "headerBackgroundColor": 4291821568,
    "headerTextColor": 4294967295,
    "bodyBackgroundColor": 4293271831,
    "bodyTextColor": 4294967295,
    "authorExternalChannelId": "UC95_zFNr4pg1hD0rMDhTDcg",
    "authorNameTextColor": 3019898879,
    "contextMenuEndpoint": {
      "clickTrackingParams": "CCwQ7rsEIhMI6ICQ3cepigMVlvJMAh0J0ydD",
      "commandMetadata": {
        "webCommandMetadata": {
          "ignoreNavigation": true
        }
      },
      "liveChatItemContextMenuEndpoint": {
        "params": "Q2g0S0hBb2FRMDB0Ym1wamVVZHhXVzlFUmxSWVJIZG5VV1J3ZGpnd1NHY2FLU29uQ2hoVlEySnJlVFV5TWtwclJVWklWbTl1VGxReVRYTnRSa0VTQzBaMlFVczVSVzF6YUZKcklBRW9CRElhQ2hoVlF6azFYM3BHVG5JMGNHY3hhRVF3Y2sxRWFGUkVZMmM0QWtnQVVBOCUzRA=="
      }
    },
    "timestampColor": 2164260863,
    "contextMenuAccessibility": {
      "accessibilityData": {
        "label": "Chat actions"
      }
    },
    "trackingParams": "CCwQ7rsEIhMI6ICQ3cepigMVlvJMAh0J0ydD",
    "headerOverlayImage": {
      "thumbnails": [
        {
          "url": "https://www.gstatic.com/youtube/img/pdg/novelty/1st_purchase_celebration_novelty_animation/1st_Purchase_Celebration_Novelty_SC_IL_T7_v1.webp",
          "width": 130,
          "height": 48
        }
      ]
    },
    "authorBadges": [
      {
        "liveChatAuthorBadgeRenderer": {
          "customThumbnail": {
            "thumbnails": [
              {
                "url": "https://yt3.ggpht.com/WrfoTKKqCeWXBrvVO4DVp6jhLK83Wp768_02yuFCTZ5JLZSXbij91a7YWUTkP5SOLM7z_F1S=s16-c-k",
                "width": 16,
                "height": 16
              },
              {
                "url": "https://yt3.ggpht.com/WrfoTKKqCeWXBrvVO4DVp6jhLK83Wp768_02yuFCTZ5JLZSXbij91a7YWUTkP5SOLM7z_F1S=s32-c-k",
                "width": 32,
                "height": 32
              }
            ]
          },
          "tooltip": "New member",
          "accessibility": {
            "accessibilityData": {
              "label": "New member"
            }
          }
        }
      }
    ],
    "textInputBackgroundColor": 805306368,
    "lowerBumper": {
      "liveChatItemBumperViewModel": {
        "content": {
          "bumperUserEduContentViewModel": {
            "text": {
              "content": "Let's celebrate their 1st Super on a live stream",
              "styleRuns": [
                {
                  "startIndex": 0,
                  "length": 48
                }
              ]
            },
            "trackingParams": "CDMQk5YLIhMI6ICQ3cepigMVlvJMAh0J0ydD",
            "image": {
              "sources": [
                {
                  "clientResource": {
                    "imageName": "CELEBRATION",
                    "imageColor": 4294901760
                  }
                }
              ]
            }
          }
        },
        "pdgPurchasedBumperLoggingDirectives": {
          "loggingDirectives": {
            "trackingParams": "CDIQ784LIhMI6ICQ3cepigMVlvJMAh0J0ydD",
            "visibility": {
              "types": "12"
            }
          }
        }
      }
    },
    "creatorHeartButton": {
      "creatorHeartViewModel": {
        "creatorThumbnail": {
          "sources": [
            {
              "url": "https://yt3.ggpht.com/laFjb4QiJEAtkTMhklPWcmLASZSdMPE6Blqrqo2RtdbebqXwQpYGDAC80bo3QhTInCiEQ4i-eCA=s48-c-k-c0x00ffffff-no-rj"
            }
          ]
        },
        "heartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart-filled"
              }
            }
          ]
        },
        "unheartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart"
              }
            }
          ],
          "processor": {
            "borderImageProcessor": {
              "imageTint": {
                "color": 4294967295
              }
            }
          }
        },
        "heartedHoverText": "❤ by 柳葉魚子醬 / Yanagiba Nanako Ch.",
        "heartedAccessibilityLabel": "Remove heart",
        "unheartedAccessibilityLabel": "Heart",
        "engagementStateKey": "EktsaXZlLWNoYXQtbWVzc2FnZS1lbmdhZ2VtZW50LXN0YXRlLUNod0tHa05OTFc1cVkzbEhjVmx2UkVaVVdFUjNaMUZrY0hZNE1FaG4gLCgB",
        "gradient": {
          "sources": [
            {
              "url": "//youtube.com/img/pdg/gradient.png"
            }
          ],
          "processor": {
            "borderImageProcessor": {
              "imageTint": {
                "color": 4293271831
              }
            }
          }
        },
        "loggingDirectives": {
          "trackingParams": "CDEQr5gLIhMI6ICQ3cepigMVlvJMAh0J0ydD",
          "visibility": {
            "types": "4"
          }
        }
      }
    },
    "isV2Style": true,
    "pdgPurchasedNoveltyLoggingDirectives": {
      "loggingDirectives": {
        "trackingParams": "CDAQ7s4LIhMI6ICQ3cepigMVlvJMAh0J0ydD",
        "visibility": {
          "types": "12"
        }
      }
    },
    "pdgLikeButton": {
      "pdgLikeViewModel": {
        "toggleButton": {
          "toggleButtonViewModel": {
            "defaultButtonViewModel": {
              "buttonViewModel": {
                "trackingParams": "CC8QkpQMIhMI6ICQ3cepigMVlvJMAh0J0ydD",
                "loggingDirectives": {
                  "trackingParams": "CC8QkpQMIhMI6ICQ3cepigMVlvJMAh0J0ydD",
                  "visibility": {
                    "types": "12"
                  }
                }
              }
            },
            "toggledButtonViewModel": {
              "buttonViewModel": {
                "trackingParams": "CC4QhJUMIhMI6ICQ3cepigMVlvJMAh0J0ydD",
                "loggingDirectives": {
                  "trackingParams": "CC4QhJUMIhMI6ICQ3cepigMVlvJMAh0J0ydD",
                  "visibility": {
                    "types": "12"
                  }
                }
              }
            },
            "trackingParams": "CCwQ7rsEIhMI6ICQ3cepigMVlvJMAh0J0ydD"
          }
        }
      }
    },
    "replyButton": {
      "pdgReplyButtonViewModel": {
        "replyButton": {
          "buttonViewModel": {
            "iconName": "CHAT",
            "onTap": {
              "innertubeCommand": {
                "clickTrackingParams": "CC0Q68ENIhMI6ICQ3cepigMVlvJMAh0J0ydD",
                "showEngagementPanelEndpoint": {
                  "identifier": {
                    "surface": "ENGAGEMENT_PANEL_SURFACE_LIVE_CHAT",
                    "tag": "PAreply_thread"
                  },
                  "globalConfiguration": {
                    "params": "ggnJAgojVWd6SnZZS0E0dVpqeEJhbV9jbDRBYUFCRHFnQjBxV3lpd0kSVgopKicKGFVDYmt5NTIySmtFRkhWb25OVDJNc21GQRILRnZBSzlFbXNoUmsQARgEIAE6I1Vnekp2WUtBNHVaanhCYW1fY2w0QWFBQkRxZ0IwcVd5aXdJGpoBCAAYACAASggQABgAIAAwAFC1pJDdx6mKA1gEYihDaHdLR2tOTk5uVnlZbE5yY1ZsdlJFWlNNMEozWjFGa2JFVXdjbXhueACiAQQaAgg8qgEMEAAaACIAKgQIABAAsAEAwAEAyAG1pJDdx6mKA-IBDAiY3fq6BhDP4cydA-gBAPABAPgBAIgCAJACAJoCDAiY3fq6BhDP4cydAyIpKicKGFVDYmt5NTIySmtFRkhWb25OVDJNc21GQRILRnZBSzlFbXNoUmsoATAA"
                  },
                  "engagementPanelPresentationConfigs": {
                    "engagementPanelPopupPresentationConfig": {
                      "popupType": "PANEL_POPUP_TYPE_DIALOG"
                    }
                  }
                }
              }
            },
            "accessibilityText": "Reply",
            "style": "BUTTON_VIEW_MODEL_STYLE_CUSTOM",
            "trackingParams": "CC0Q68ENIhMI6ICQ3cepigMVlvJMAh0J0ydD",
            "type": "BUTTON_VIEW_MODEL_TYPE_TONAL",
            "buttonSize": "BUTTON_VIEW_MODEL_SIZE_XSMALL",
            "customBackgroundColor": 452984831,
            "customFontColor": 4294967295,
            "onVisible": {
              "innertubeCommand": {
                "clickTrackingParams": "CC0Q68ENIhMI6ICQ3cepigMVlvJMAh0J0ydD",
                "logFlowLoggingEventCommand": {
                  "flowEventType": 1,
                  "flowEventNamespace": "FLOW_EVENT_NAMESPACE_LIVE_CHAT_ENGAGEMENT",
                  "flowType": "FLOW_TYPE_LIVE_CHAT_ENGAGEMENT",
                  "flowEventMetadata": {
                    "liveChatEngagementContext": {
                      "entryPointType": "LIVE_CHAT_ENGAGEMENT_ENTRY_POINT_REPLY_BUTTON"
                    }
                  }
                }
              }
            },
            "loggingDirectives": {
              "trackingParams": "CC0Q68ENIhMI6ICQ3cepigMVlvJMAh0J0ydD",
              "visibility": {
                "types": "12"
              }
            }
          }
        },
        "replyCountEntityKey": "EiNVZ3pKdllLQTR1Wmp4QmFtX2NsNEFhQUJEcWdCMHFXeWl3SSDxAygB",
        "replyCountPlaceholder": {
          "content": "Reply",
          "styleRuns": [
            {
              "startIndex": 0,
              "length": 5
            }
          ]
        }
      }
    }
  }
}

When a viewer donates for the 1st, 3rd, 5th, 10th, or 20th time,
there will be a special type of `LiveChatPaidMessage` that includes an
animated image in the header, followed by a bumper text message.
@LuanRT LuanRT merged commit ef37aa0 into LuanRT:main Dec 22, 2024
4 checks passed
@jonz94 jonz94 deleted the update-LiveChatPaidMessage branch December 23, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants