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(parser): Update LiveChatPaidMessage #846

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

jonz94
Copy link
Contributor

@jonz94 jonz94 commented Dec 15, 2024

This PR updates the LiveChatPaidMessage parser:

  • Add author_name_text_color property
  • Add context_menu_accessibility_label property
  • Add timestamp_usec property
  • Mark timestamp_text property as optional
  • Add timestamp_color property
  • Add text_input_background_color property
  • Add creator_heart_button property
  • Add is_v2_style property
  • Add reply_button property

Example RawNode data 1:

{
  "liveChatPaidMessageRenderer": {
    "id": "ChwKGkNKMjByTlNKenZvQ0ZmUVo1d29kZFc4TEdB",
    "timestampUsec": "1665144247876066",
    "authorName": {
      "simpleText": "天野よなく"
    },
    "authorPhoto": {
      "thumbnails": [
        {
          "url": "https://yt4.ggpht.com/ytc/AIdro_l49U75p-6oIHx0Zd5WW1LvI1OeNpW06pFYyL-rTCNm6b4=s32-c-k-c0x00ffffff-no-rj",
          "width": 32,
          "height": 32
        },
        {
          "url": "https://yt4.ggpht.com/ytc/AIdro_l49U75p-6oIHx0Zd5WW1LvI1OeNpW06pFYyL-rTCNm6b4=s64-c-k-c0x00ffffff-no-rj",
          "width": 64,
          "height": 64
        }
      ]
    },
    "purchaseAmountText": {
      "simpleText": "NT$75.00"
    },
    "message": {
      "runs": [
        {
          "text": "用一下免費的SC 我好怕喔"
        }
      ]
    },
    "headerBackgroundColor": 4278239141,
    "headerTextColor": 4278190080,
    "bodyBackgroundColor": 4280150454,
    "bodyTextColor": 4278190080,
    "authorExternalChannelId": "UCwSuo-AjWlCrVZp7Azjgp6A",
    "authorNameTextColor": 2315255808,
    "contextMenuEndpoint": {
      "clickTrackingParams": "CBYQ7rsEIhMInLa6wJnjiQMVcs40Bx3odTwJ",
      "commandMetadata": {
        "webCommandMetadata": {
          "ignoreNavigation": true
        }
      },
      "liveChatItemContextMenuEndpoint": {
        "params": "Q2g0S0hBb2FRMG95TUhKT1UwcDZkbTlEUm1aUldqVjNiMlJrVnpoTVIwRWFLU29uQ2hoVlF6SmFWMmRuYjI0eFRrOVVNbFJIWVZaVlRYcFpOMEVTQzBSZlZUQjJWRXB5ZGw5VklBRW9CRElhQ2hoVlEzZFRkVzh0UVdwWGJFTnlWbHB3TjBGNmFtZHdOa0U0QWtnQlVBOCUzRA=="
      }
    },
    "timestampColor": 2147483648,
    "contextMenuAccessibility": {
      "accessibilityData": {
        "label": "Chat actions"
      }
    },
    "timestampText": {
      "simpleText": "4:11"
    },
    "trackingParams": "CBYQ7rsEIhMInLa6wJnjiQMVcs40Bx3odTwJ",
    "textInputBackgroundColor": 822083583,
    "creatorHeartButton": {
      "creatorHeartViewModel": {
        "creatorThumbnail": {
          "sources": [
            {
              "url": "https://yt3.ggpht.com/lQaEUeJlLtgioCU0npPsaYOLzg2idrzG0XY_jn-fjPOySnv4nN94U0rCTt5shavBR9brK-e6Tg=s48-c-k-c0x00ffffff-no-rj"
            }
          ]
        },
        "heartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart-filled"
              }
            }
          ]
        },
        "unheartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart"
              }
            }
          ],
          "processor": {
            "borderImageProcessor": {
              "imageTint": {
                "color": 4278190080
              }
            }
          }
        },
        "heartedHoverText": "❤ by 庫洛姆•Kuromu",
        "heartedAccessibilityLabel": "Remove heart",
        "unheartedAccessibilityLabel": "Heart",
        "engagementStateKey": "EktsaXZlLWNoYXQtbWVzc2FnZS1lbmdhZ2VtZW50LXN0YXRlLUNod0tHa05LTWpCeVRsTktlblp2UTBabVVWbzFkMjlrWkZjNFRFZEIgLCgB"
      }
    },
    "isV2Style": true,
    "replyButton": {
      "pdgReplyButtonViewModel": {
        "replyButton": {
          "buttonViewModel": {
            "iconName": "CHAT",
            "onTap": {
              "innertubeCommand": {
                "clickTrackingParams": "CBcQ68ENIhMInLa6wJnjiQMVcs40Bx3odTwJ",
                "showEngagementPanelEndpoint": {
                  "identifier": {
                    "surface": "ENGAGEMENT_PANEL_SURFACE_LIVE_CHAT",
                    "tag": "PAreply_thread"
                  },
                  "globalConfiguration": {
                    "params": "ggm2AQojVWd4X2owTGZlUFRaQkV2VExLaDRBYUFCRHFnQnRaNlZsd0kSVgopKicKGFVDMlpXZ2dvbjFOT1QyVEdhVlVNelk3QRILRF9VMHZUSnJ2X1UQARgEIAE6I1VneF9qMExmZVBUWkJFdlRMS2g0QWFBQkRxZ0J0WjZWbHdJGgggALABAPgBACIpKicKGFVDMlpXZ2dvbjFOT1QyVEdhVlVNelk3QRILRF9VMHZUSnJ2X1UoATAB"
                  },
                  "engagementPanelPresentationConfigs": {
                    "engagementPanelPopupPresentationConfig": {
                      "popupType": "PANEL_POPUP_TYPE_DIALOG"
                    }
                  }
                }
              }
            },
            "accessibilityText": "Reply",
            "style": "BUTTON_VIEW_MODEL_STYLE_CUSTOM",
            "trackingParams": "CBcQ68ENIhMInLa6wJnjiQMVcs40Bx3odTwJ",
            "type": "BUTTON_VIEW_MODEL_TYPE_TONAL",
            "buttonSize": "BUTTON_VIEW_MODEL_SIZE_XSMALL",
            "customBackgroundColor": 218103808,
            "customFontColor": 4278190080,
            "loggingDirectives": {
              "trackingParams": "CBcQ68ENIhMInLa6wJnjiQMVcs40Bx3odTwJ",
              "visibility": {
                "types": "12"
              },
              "enableDisplayloggerExperiment": true
            }
          }
        },
        "replyCountEntityKey": "EiNVZ3hfajBMZmVQVFpCRXZUTEtoNEFhQUJEcWdCdFo2Vmx3SSDxAygB",
        "replyCountPlaceholder": {
          "content": "Reply",
          "styleRuns": [
            {
              "startIndex": 0,
              "length": 5
            }
          ]
        }
      }
    }
  }
}

Example RawNode data 2:

{
  "liveChatPaidMessageRenderer": {
    "id": "ChwKGkNMWEVvcmFvcFlvREZYM0N3Z1FkY2xJa25R",
    "timestampUsec": "1734112508476032",
    "authorName": {
      "simpleText": ""
    },
    "authorPhoto": {
      "thumbnails": [
        {
          "url": "https://yt4.ggpht.com/VGq8Jh9ZBOSe3N9qduOnj573aFjmZqS4JSXolFzoFA4t5a4NBUF4NUlqDchqYIxl8mGN99z-=s32-c-k-c0x00ffffff-no-rj",
          "width": 32,
          "height": 32
        },
        {
          "url": "https://yt4.ggpht.com/VGq8Jh9ZBOSe3N9qduOnj573aFjmZqS4JSXolFzoFA4t5a4NBUF4NUlqDchqYIxl8mGN99z-=s64-c-k-c0x00ffffff-no-rj",
          "width": 64,
          "height": 64
        }
      ]
    },
    "purchaseAmountText": {
      "simpleText": "HK$100.00"
    },
    "message": {
      "runs": [
        {
          "text": "想投綠界的時候發現...只能用YT的..這個不能一閃而過嗎"
        }
      ]
    },
    "headerBackgroundColor": 4293284096,
    "headerTextColor": 3758096383,
    "bodyBackgroundColor": 4294278144,
    "bodyTextColor": 3758096383,
    "authorExternalChannelId": "UCv55nnv26sizKp0hexHBFxQ",
    "authorNameTextColor": 3019898879,
    "contextMenuEndpoint": {
      "clickTrackingParams": "CCoQ7rsEIhMImvyV4amligMVsJK5BR0uhiju",
      "commandMetadata": {
        "webCommandMetadata": {
          "ignoreNavigation": true
        }
      },
      "liveChatItemContextMenuEndpoint": {
        "params": "Q2g0S0hBb2FRMHhZUlc5eVlXOXdXVzlFUmxnelEzZG5VV1JqYkVscmJsRWFLU29uQ2hoVlEwVkZkMlZHZEY5c1VFNU9WR2wzVTFVeldpMHRhbWNTQ3paVVlXdzJhbkk0YVZCWklBRW9CRElhQ2hoVlEzWTFOVzV1ZGpJMmMybDZTM0F3YUdWNFNFSkdlRkU0QWtnQVVBOCUzRA=="
      }
    },
    "timestampColor": 2164260863,
    "contextMenuAccessibility": {
      "accessibilityData": {
        "label": "Chat actions"
      }
    },
    "trackingParams": "CCoQ7rsEIhMImvyV4amligMVsJK5BR0uhiju",
    "textInputBackgroundColor": 805306368,
    "creatorHeartButton": {
      "creatorHeartViewModel": {
        "creatorThumbnail": {
          "sources": [
            {
              "url": "https://yt3.ggpht.com/KdYuzSiJbBJZv_bmz-TdabkHbactoCrNXnuC7OuBmxsG3jYMZMZZNTRsBimVZB84TDWK4pXLYg=s48-c-k-c0x00ffffff-no-rj"
            }
          ]
        },
        "heartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart-filled"
              }
            }
          ]
        },
        "unheartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart"
              }
            }
          ],
          "processor": {
            "borderImageProcessor": {
              "imageTint": {
                "color": 3758096383
              }
            }
          }
        },
        "heartedHoverText": "❤ by Atama Hikari 光頭 Ch.",
        "heartedAccessibilityLabel": "Remove heart",
        "unheartedAccessibilityLabel": "Heart",
        "engagementStateKey": "EktsaXZlLWNoYXQtbWVzc2FnZS1lbmdhZ2VtZW50LXN0YXRlLUNod0tHa05NV0VWdmNtRnZjRmx2UkVaWU0wTjNaMUZrWTJ4SmEyNVIgLCgB",
        "loggingDirectives": {
          "trackingParams": "CCwQr5gLIhMImvyV4amligMVsJK5BR0uhiju",
          "visibility": {
            "types": "4"
          }
        }
      }
    },
    "isV2Style": true,
    "replyButton": {
      "pdgReplyButtonViewModel": {
        "replyButton": {
          "buttonViewModel": {
            "iconName": "CHAT",
            "onTap": {
              "innertubeCommand": {
                "clickTrackingParams": "CCsQ68ENIhMImvyV4amligMVsJK5BR0uhiju",
                "showEngagementPanelEndpoint": {
                  "identifier": {
                    "surface": "ENGAGEMENT_PANEL_SURFACE_LIVE_CHAT",
                    "tag": "PAreply_thread"
                  },
                  "globalConfiguration": {
                    "params": "ggmaAgojVWd6RWJQdWNPMzQwTmRMdXNtTjRBYUFCRHFnQjRNVGlsUUkSVgopKicKGFVDRUV3ZUZ0X2xQTk5UaXdTVTNaLS1qZxILNlRhbDZqcjhpUFkQARgEIAE6I1VnekViUHVjTzM0ME5kTHVzbU40QWFBQkRxZ0I0TVRpbFFJGmwIABgAIABKCBAAGAAgADAAULyPluGppYoDWAN4AKIBAKoBDBAAGgAiACoECAAQALABAMABAMgBvI-W4amligPiAQwIzezxugYQ3Om9nwHoAQDwAQD4AQCIAgCQAgCaAgwIzezxugYQ3Om9nwEiKSonChhVQ0VFd2VGdF9sUE5OVGl3U1UzWi0tamcSCzZUYWw2anI4aVBZKAEwAA%3D%3D"
                  },
                  "engagementPanelPresentationConfigs": {
                    "engagementPanelPopupPresentationConfig": {
                      "popupType": "PANEL_POPUP_TYPE_DIALOG"
                    }
                  }
                }
              }
            },
            "accessibilityText": "Reply",
            "style": "BUTTON_VIEW_MODEL_STYLE_CUSTOM",
            "trackingParams": "CCsQ68ENIhMImvyV4amligMVsJK5BR0uhiju",
            "type": "BUTTON_VIEW_MODEL_TYPE_TONAL",
            "buttonSize": "BUTTON_VIEW_MODEL_SIZE_XSMALL",
            "customBackgroundColor": 452984831,
            "customFontColor": 3758096383,
            "onVisible": {
              "innertubeCommand": {
                "clickTrackingParams": "CCsQ68ENIhMImvyV4amligMVsJK5BR0uhiju",
                "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": "CCsQ68ENIhMImvyV4amligMVsJK5BR0uhiju",
              "visibility": {
                "types": "12"
              }
            }
          }
        },
        "replyCountEntityKey": "EiNVZ3pFYlB1Y08zNDBOZEx1c21ONEFhQUJEcWdCNE1UaWxRSSDxAygB",
        "replyCountPlaceholder": {
          "content": "Reply",
          "styleRuns": [
            {
              "startIndex": 0,
              "length": 5
            }
          ]
        }
      }
    }
  }
}

Example RawNode data 3:

{
  "liveChatPaidMessageRenderer": {
    "id": "ChwKGkNJRDZ6T0djcUlvREZjVFp3Z1FkcVdRUGdn",
    "timestampUsec": "1734212455471391",
    "authorName": {
      "simpleText": "傑哥-麵大"
    },
    "authorPhoto": {
      "thumbnails": [
        {
          "url": "https://yt4.ggpht.com/e43VW12d6iLs7bBsjheAfjJevpQPQePK9iZbBuVoWL7c3Cn0AmLFMU0pRjZqiFPcoLIytlU7seE=s32-c-k-c0x00ffffff-no-rj",
          "width": 32,
          "height": 32
        },
        {
          "url": "https://yt4.ggpht.com/e43VW12d6iLs7bBsjheAfjJevpQPQePK9iZbBuVoWL7c3Cn0AmLFMU0pRjZqiFPcoLIytlU7seE=s64-c-k-c0x00ffffff-no-rj",
          "width": 64,
          "height": 64
        }
      ]
    },
    "purchaseAmountText": {
      "simpleText": "NT$75.00"
    },
    "message": {
      "runs": [
        {
          "text": "先去睡了,謝謝薇妮這陣子常開這麼chill的深夜森友會,讓我度過枯燥的工作or讀書時間(潛水久了忽然想說"
        },
        {
          "emoji": {
            "emojiId": "🦈",
            "shortcuts": [":shark:"],
            "searchTerms": ["shark"],
            "image": {
              "thumbnails": [
                {
                  "url": "https://fonts.gstatic.com/s/e/notoemoji/15.1/1f988/72.png"
                }
              ],
              "accessibility": {
                "accessibilityData": {
                  "label": "🦈"
                }
              }
            }
          }
        }
      ]
    },
    "headerBackgroundColor": 4278239141,
    "headerTextColor": 4278190080,
    "bodyBackgroundColor": 4280150454,
    "bodyTextColor": 4278190080,
    "authorExternalChannelId": "UCj4YPwdLxx6mo6R7gu6YtQQ",
    "authorNameTextColor": 2315255808,
    "contextMenuEndpoint": {
      "clickTrackingParams": "CB8Q7rsEIhMIueCe_p2oigMVprtWAR21JA59",
      "commandMetadata": {
        "webCommandMetadata": {
          "ignoreNavigation": true
        }
      },
      "liveChatItemContextMenuEndpoint": {
        "params": "Q2g0S0hBb2FRMGxFTm5wUFIyTnhTVzlFUm1OVVduZG5VV1J4VjFGUVoyY2FLU29uQ2hoVlEzSjVZMFIyTVhOWlZrZElOVWRMT0ZoQ1ZGaEJRbWNTQzI4eVJuUkZRa290UWs4NElBRW9CRElhQ2hoVlEybzBXVkIzWkV4NGVEWnRielpTTjJkMU5sbDBVVkU0QWtnQVVBOCUzRA=="
      }
    },
    "timestampColor": 2147483648,
    "contextMenuAccessibility": {
      "accessibilityData": {
        "label": "Chat actions"
      }
    },
    "trackingParams": "CB8Q7rsEIhMIueCe_p2oigMVprtWAR21JA59",
    "textInputBackgroundColor": 822083583,
    "creatorHeartButton": {
      "creatorHeartViewModel": {
        "creatorThumbnail": {
          "sources": [
            {
              "url": "https://yt3.ggpht.com/JNiXth-3okm798GaptgT93nsAx-ZF4URVgdI1sAzG7U3gv8SirVB27nq3RPVrmn7EqCMxCdb9Q=s48-c-k-c0x00ffffff-no-rj"
            }
          ]
        },
        "heartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart-filled"
              }
            }
          ]
        },
        "unheartedIcon": {
          "sources": [
            {
              "clientResource": {
                "imageName": "full_heart"
              }
            }
          ],
          "processor": {
            "borderImageProcessor": {
              "imageTint": {
                "color": 4278190080
              }
            }
          }
        },
        "heartedHoverText": "❤ by ReLive_薇妮 Winnie",
        "heartedAccessibilityLabel": "Remove heart",
        "unheartedAccessibilityLabel": "Heart",
        "engagementStateKey": "EktsaXZlLWNoYXQtbWVzc2FnZS1lbmdhZ2VtZW50LXN0YXRlLUNod0tHa05KUkRaNlQwZGpjVWx2UkVaalZGcDNaMUZrY1ZkUlVHZG4gLCgB",
        "loggingDirectives": {
          "trackingParams": "CCEQr5gLIhMIueCe_p2oigMVprtWAR21JA59",
          "visibility": {
            "types": "4"
          }
        }
      }
    },
    "isV2Style": true,
    "replyButton": {
      "pdgReplyButtonViewModel": {
        "replyButton": {
          "buttonViewModel": {
            "iconName": "CHAT",
            "onTap": {
              "innertubeCommand": {
                "clickTrackingParams": "CCAQ68ENIhMIueCe_p2oigMVprtWAR21JA59",
                "showEngagementPanelEndpoint": {
                  "identifier": {
                    "surface": "ENGAGEMENT_PANEL_SURFACE_LIVE_CHAT",
                    "tag": "PAreply_thread"
                  },
                  "globalConfiguration": {
                    "params": "ggmcAgojVWd3MFh6M0kzVmhSZFNWV3BWUjRBYUFCRHFnQno2U0luUUkSVgopKicKGFVDcnljRHYxc1lWR0g1R0s4WEJUWEFCZxILbzJGdEVCSi1CTzgQARgEIAE6I1VndzBYejNJM1ZoUmRTVldwVlI0QWFBQkRxZ0J6NlNJblFJGm4IABgAIABKCBAAGAAgADAAUMz0nv6dqIoDWAR4AKIBAhoAqgEMEAAaACIAKgQIABAAsAEAwAEAyAHM9J7-naiKA-IBDAic-fe6BhCUwpKIAegBAPABAPgBAIgCAJACAJoCDAic-fe6BhCUwpKIASIpKicKGFVDcnljRHYxc1lWR0g1R0s4WEJUWEFCZxILbzJGdEVCSi1CTzgoATAA"
                  },
                  "engagementPanelPresentationConfigs": {
                    "engagementPanelPopupPresentationConfig": {
                      "popupType": "PANEL_POPUP_TYPE_DIALOG"
                    }
                  }
                }
              }
            },
            "accessibilityText": "Reply",
            "style": "BUTTON_VIEW_MODEL_STYLE_CUSTOM",
            "trackingParams": "CCAQ68ENIhMIueCe_p2oigMVprtWAR21JA59",
            "type": "BUTTON_VIEW_MODEL_TYPE_TONAL",
            "buttonSize": "BUTTON_VIEW_MODEL_SIZE_XSMALL",
            "customBackgroundColor": 218103808,
            "customFontColor": 4278190080,
            "onVisible": {
              "innertubeCommand": {
                "clickTrackingParams": "CCAQ68ENIhMIueCe_p2oigMVprtWAR21JA59",
                "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": "CCAQ68ENIhMIueCe_p2oigMVprtWAR21JA59",
              "visibility": {
                "types": "12"
              }
            }
          }
        },
        "replyCountEntityKey": "EiNVZ3cwWHozSTNWaFJkU1ZXcFZSNEFhQUJEcWdCejZTSW5RSSDxAygB",
        "replyCountPlaceholder": {
          "content": "Reply",
          "styleRuns": [
            {
              "startIndex": 0,
              "length": 5
            }
          ]
        }
      }
    }
  }
}

* Add `author_name_text_color` property
* Add `context_menu_accessibility_label` property
* Add `timestamp_usec` property
* Mark `timestamp_text` property as optional
* Add `timestamp_color` property
* Add `text_input_background_color` property
* Add `creator_heart_button` property
* Add `is_v2_style` property
* Add `reply_button` property
@LuanRT LuanRT merged commit 73362c6 into LuanRT:main Dec 15, 2024
4 checks passed
@jonz94 jonz94 deleted the update-LiveChatPaidMessage branch December 16, 2024 09:42
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