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): Add LiveChatSponsorshipsGiftPurchaseAnnouncement and LiveChatSponsorshipsHeader nodes #793

Merged

Conversation

jonz94
Copy link
Contributor

@jonz94 jonz94 commented Nov 1, 2024

Add a new parser for the live chat node that appears when someone sends gifted memberships.

Example RawNode data:

{
  "liveChatSponsorshipsGiftPurchaseAnnouncementRenderer": {
    "id": "ChwKGkNKdUVzTmJRbW9rREZZMlY1UWNkU3dJSDZ3",
    "timestampUsec": "1729347301072447",
    "authorExternalChannelId": "UCnkXGpBlY-1aJGuQASWs1gw",
    "header": {
      "liveChatSponsorshipsHeaderRenderer": {
        "authorName": {
          "simpleText": "Lance蘭斯"
        },
        "authorPhoto": {
          "thumbnails": [
            {
              "url": "https://yt4.ggpht.com/1ghjNFZV9AH4fOlq2eJYS7SG0z_VuBm7zKINkYZdxJ3_edCLhqYfNw-YfbcSzAg7QCnQ_XtB=s32-c-k-c0x00ffffff-no-rj",
              "width": 32,
              "height": 32
            },
            {
              "url": "https://yt4.ggpht.com/1ghjNFZV9AH4fOlq2eJYS7SG0z_VuBm7zKINkYZdxJ3_edCLhqYfNw-YfbcSzAg7QCnQ_XtB=s64-c-k-c0x00ffffff-no-rj",
              "width": 64,
              "height": 64
            }
          ]
        },
        "primaryText": {
          "runs": [
            {
              "text": "Gifted ",
              "bold": true
            },
            {
              "text": "5",
              "bold": true
            },
            {
              "text": " ",
              "bold": true
            },
            {
              "text": "庫洛姆•Kuromu",
              "bold": true
            },
            {
              "text": " memberships",
              "bold": true
            }
          ]
        },
        "authorBadges": [
          {
            "liveChatAuthorBadgeRenderer": {
              "icon": {
                "iconType": "MODERATOR"
              },
              "tooltip": "Moderator",
              "accessibility": {
                "accessibilityData": {
                  "label": "Moderator"
                }
              }
            }
          },
          {
            "liveChatAuthorBadgeRenderer": {
              "customThumbnail": {
                "thumbnails": [
                  {
                    "url": "https://yt3.ggpht.com/X9RkCDxc0D7OtVbbJAxZGXbV4-PZw0cg2h_Vg1C6ahIVaYrcTubP1WF3313-LjKz9PRHgY_fVw=s16-c-k",
                    "width": 16,
                    "height": 16
                  },
                  {
                    "url": "https://yt3.ggpht.com/X9RkCDxc0D7OtVbbJAxZGXbV4-PZw0cg2h_Vg1C6ahIVaYrcTubP1WF3313-LjKz9PRHgY_fVw=s32-c-k",
                    "width": 32,
                    "height": 32
                  }
                ]
              },
              "tooltip": "Member (6 months)",
              "accessibility": {
                "accessibilityData": {
                  "label": "Member (6 months)"
                }
              }
            }
          }
        ],
        "contextMenuEndpoint": {
          "clickTrackingParams": "CAoQ3MMKIhMIkszl-JW7iQMVcNY0Bx04tAU-",
          "commandMetadata": {
            "webCommandMetadata": {
              "ignoreNavigation": true
            }
          },
          "liveChatItemContextMenuEndpoint": {
            "params": "Q2g0S0hBb2FRMHAxUlhOT1lsRnRiMnRFUmxreVZqVlJZMlJUZDBsSU5uY2FLU29uQ2hoVlF6SmFWMmRuYjI0eFRrOVVNbFJIWVZaVlRYcFpOMEVTQzI5SU1IRktTbkZGUWxKRklBRW9CRElhQ2hoVlEyNXJXRWR3UW14WkxURmhTa2QxVVVGVFYzTXhaM2M0QWtnQlVDUSUzRA=="
          }
        },
        "contextMenuAccessibility": {
          "accessibilityData": {
            "label": "Chat actions"
          }
        },
        "image": {
          "thumbnails": [
            {
              "url": "https://www.gstatic.com/youtube/img/sponsorships/sponsorships_gift_purchase_announcement_artwork.png"
            }
          ]
        }
      }
    }
  }
}

Copy link
Collaborator

@absidue absidue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your pull request. Most of it is great, I've just noted two small potential improvements.

Copy link
Owner

@LuanRT LuanRT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I'll go ahead and merge it once @absidue approves the changes, as they've also reviewed it.

@LuanRT LuanRT merged commit 4e9c2a5 into LuanRT:main Nov 2, 2024
4 checks passed
@jonz94 jonz94 deleted the add-LiveChatSponsorshipsGiftPurchaseAnnouncement branch November 13, 2024 09:05
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.

3 participants