I've been poking around at the YouTube live chat API to render out a custom chat feed, and was wondering how I can show membership/sponsorship badges next to users like the YouTube site itself does?
Looking at a response from the API, I can see that YouTube does tell me the user is a member/sponsor, but it doesn't include at what level/duration nor what badge image should be shown:
{"kind": "youtube#liveChatMessage","etag": "MHpDf4piJnYR2X3lP-7mwBavfWM","id": "LCC.CjgKDQoLd1VwYUIzYTdkVW8qJwoYVUNEWExPVjNTMEdUd21EOFY4R1A2dzlREgt3VXBhQjNhN2RVbxI7ChpDSVRodDQzS292VUNGZVV0clFZZHNJRUwzZxIdQ1B1VHJiYV9vdlVDRllhRGdnb2RaUE1LanctMjY","snippet": {"type": "textMessageEvent","liveChatId": "Cg0KC3dVcGFCM2E3ZFVvKicKGFVDRFhMT1YzUzBHVHdtRDhWOEdQNnc5URILd1VwYUIzYTdkVW8","authorChannelId": "UCYC1zf9Dznp-xpe9rwEopLQ","publishedAt": "2022-01-08T16:31:12.317Z","hasDisplayContent": true,"displayMessage": "Instead of waiting 30 seconds you had to spam facecam now you get a 5 minute timeout","textMessageDetails": {"messageText": "Instead of waiting 30 seconds you had to spam facecam now you get a 5 minute timeout" } },"authorDetails": {"channelId": "UCYC1zf9Dznp-xpe9rwEopLQ","channelUrl": "http://www.youtube.com/channel/UCYC1zf9Dznp-xpe9rwEopLQ","displayName": "Cody Kerley","profileImageUrl": "https://yt3.ggpht.com/ytc/AKedOLQFiwv-x6ukfTOh7pD7WlCe7Ss1AB5wH7QAF53uiQ=s88-c-k-c0x00ffffff-no-rj","isVerified": false,"isChatOwner": false,"isChatSponsor": true,"isChatModerator": true }}
But if I look at how this message was shown in the YouTube chat itself, the user has the correct membership badge for their level/duration, specific to this channel, and the tooltip also shows you the level/duration of the membership/sponsorship:
How can I get this information from the API for each chat message so that I can render the badge correctly myself?
Cheers.