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

Feature/membership gift #78

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

totoraj930
Copy link

データが取れたので実装しました。

ただ、ギフトの個数などの情報が含まれていません。

ギフトのほかに受け取り通知もあるのですが、そちらはあまり情報が取れなさそうだったので実装を見送りました。

検討の余地があるかもしれません。

よろしくお願いします。

サンプル↓

{
  "clickTrackingParams": "clickTrackingParams",
  "addChatItemAction": {
    "item": {
      "liveChatSponsorshipsGiftPurchaseAnnouncementRenderer": {
        "id": "id",
        "timestampUsec": "1654349191361933",
        "authorExternalChannelId": "channelId",
        "header": {
          "liveChatSponsorshipsHeaderRenderer": {
            "authorName": {
              "simpleText": "authorName"
            },
            "authorPhoto": {
              "thumbnails": [
                {
                  "url": "https://author.thumbnail.url",
                  "width": 32,
                  "height": 32
                },
                {
                  "url": "https://author.thumbnail.url",
                  "width": 64,
                  "height": 64
                }
              ]
            },
            "primaryText": {
              "runs": [
                {
                  "text": "5",
                  "bold": true
                },
                {
                  "text": " 件の ",
                  "bold": true
                },
                {
                  "text": "上級エンジニア",
                  "bold": true
                },
                {
                  "text": " のメンバーシップ ギフトを贈りました",
                  "bold": true
                }
              ]
            },
            "authorBadges": [
              {
                "liveChatAuthorBadgeRenderer": {
                  "customThumbnail": {
                    "thumbnails": [
                      {
                        "url": "https://membership.badge.url"
                      },
                      {
                        "url": "https://membership.badge.url"
                      }
                    ]
                  },
                  "tooltip": "メンバー(2 年)",
                  "accessibility": {
                    "accessibilityData": {
                      "label": "メンバー(2 年)"
                    }
                  }
                }
              }
            ],
            "contextMenuEndpoint": {
              "clickTrackingParams": "clickTrackingParams",
              "commandMetadata": {
                "webCommandMetadata": {
                  "ignoreNavigation": true
                }
              },
              "liveChatItemContextMenuEndpoint": {
                "params": "params"
              }
            },
            "contextMenuAccessibility": {
              "accessibilityData": {
                "label": "チャットの操作"
              }
            },
            "image": {
              "thumbnails": [
                {
                  "url": "https://www.gstatic.com/youtube/img/sponsorships/sponsorships_gift_purchase_announcement_artwork.png"
                }
              ]
            }
          }
        }
      }
    }
  }
}

受け取りのサンプル↓

{
  "clickTrackingParams": "clickTrackingParams",
  "addChatItemAction": {
    "item": {
      "liveChatSponsorshipsGiftRedemptionAnnouncementRenderer": {
        "id": "id",
        "timestampUsec": "1654349198469933",
        "authorExternalChannelId": "channelId",
        "authorName": {
          "simpleText": "authorName"
        },
        "authorPhoto": {
          "thumbnails": [
            {
              "url": "https://author.thumbnail.url",
              "width": 32,
              "height": 32
            },
            {
              "url": "https://author.thumbnail.url",
              "width": 64,
              "height": 64
            }
          ]
        },
        "message": {
          "runs": [
            {
              "text": "さんに ",
              "italics": true
            },
            {
              "text": "authorName0",
              "bold": true,
              "italics": true
            },
            {
              "text": " さんからメンバーシップ ギフトが贈られました",
              "italics": true
            }
          ]
        },
        "contextMenuEndpoint": {
          "clickTrackingParams": "clickTrackingParams",
          "commandMetadata": {
            "webCommandMetadata": {
              "ignoreNavigation": true
            }
          },
          "liveChatItemContextMenuEndpoint": {
            "params": "params"
          }
        },
        "contextMenuAccessibility": {
          "accessibilityData": {
            "label": "チャットの操作"
          }
        },
        "trackingParams": "trackingParams"
      }
    }
  }
}

@FlashlightXi
Copy link

FlashlightXi commented Jan 9, 2023

#70 より、メンバーマイルストーンの追加もよろしければお願いします🙏
マイルストーンのサンプルはこちら (英語のクライアントからの情報です) ↓

{
    "clickTrackingParams": "clickTrackingParams",
    "addChatItemAction": {
        "item": {
            "liveChatMembershipItemRenderer": {
                "id": "id",
                "timestampUsec": "1673268163978032",
                "authorExternalChannelId": "ChannelID",
                "headerPrimaryText": {
                    "runs": [
                        {
                            "text": "Member for 1 month"
                        }
                    ]
                },
                "headerSubtext": { // メンバーシップのレベルの名前
                    "simpleText": "NAME OF MEMBERSHIPS"
                },
                "message": { // マイルストーンのメッセージ
                    "runs": [
                        {
                            "text": "Hi"
                        }
                    ]
                },
                "authorName": { // メンバーの名前
                    "simpleText": "USERNAME"
                },
                "authorPhoto": { // メンバーのアイコン
                    "thumbnails": [
                        {
                            "url": "https://yt4.ggpht.com/",
                            "width": 32,
                            "height": 32
                        },
                        {
                            "url": "https://yt4.ggpht.com/",
                            "width": 64,
                            "height": 64
                        }
                    ]
                },
                "authorBadges": [ // メンバーのバッジ
                    {
                        "liveChatAuthorBadgeRenderer": {
                            "customThumbnail": {
                                "thumbnails": [
                                    {
                                        "url": "https://yt3.ggpht.com/",
                                        "width": 16,
                                        "height": 16
                                    },
                                    {
                                        "url": "https://yt3.ggpht.com/",
                                        "width": 32,
                                        "height": 32
                                    }
                                ]
                            },
                            "tooltip": "Member (1 month)",
                            "accessibility": {
                                "accessibilityData": {
                                    "label": "Member (1 month)"
                                }
                            }
                        }
                    }
                ],
                "contextMenuEndpoint": {
                    "clickTrackingParams": "clickTrackingParams",
                    "commandMetadata": {
                        "webCommandMetadata": {
                            "ignoreNavigation": true
                        }
                    },
                    "liveChatItemContextMenuEndpoint": {
                        "params": "params"
                    }
                },
                "contextMenuAccessibility": {
                    "accessibilityData": {
                        "label": "Chat actions"
                    }
                },
                "inlineActionButtons": [ // メッセージ操作等 (モデレーター用?)
                    {
                        "buttonRenderer": {
                            "style": "STYLE_DEFAULT",
                            "size": "SIZE_DEFAULT",
                            "isDisabled": false,
                            "serviceEndpoint": {
                                "clickTrackingParams": "params",
                                "commandMetadata": {
                                    "webCommandMetadata": {
                                        "sendPost": true,
                                        "apiUrl": "/youtubei/v1/live_chat/moderate"
                                    }
                                },
                                "moderateLiveChatEndpoint": {
                                    "params": "params"
                                }
                            },
                            "icon": {
                                "iconType": "DELETE"
                            },
                            "accessibility": {
                                "label": "Remove"
                            },
                            "tooltip": "Remove",
                            "trackingParams": "trackingParams",
                            "accessibilityData": {
                                "accessibilityData": {
                                    "label": "Remove"
                                }
                            }
                        }
                    },
                    {
                        "buttonRenderer": {
                            "style": "STYLE_DEFAULT",
                            "size": "SIZE_DEFAULT",
                            "isDisabled": false,
                            "serviceEndpoint": {
                                "clickTrackingParams": "clickTrackingParams",
                                "commandMetadata": {
                                    "webCommandMetadata": {
                                        "sendPost": true,
                                        "apiUrl": "/youtubei/v1/live_chat/moderate"
                                    }
                                },
                                "moderateLiveChatEndpoint": {
                                    "params": "params"
                                }
                            },
                            "icon": {
                                "iconType": "HOURGLASS"
                            },
                            "accessibility": {
                                "label": "Put user in timeout"
                            },
                            "tooltip": "Put user in timeout",
                            "trackingParams": "trackingParams",
                            "accessibilityData": {
                                "accessibilityData": {
                                    "label": "Put user in timeout"
                                }
                            }
                        }
                    },
                    {
                        "buttonRenderer": {
                            "style": "STYLE_DEFAULT",
                            "size": "SIZE_DEFAULT",
                            "isDisabled": false,
                            "serviceEndpoint": {
                                "clickTrackingParams": "clickTrackingParams",
                                "commandMetadata": {
                                    "webCommandMetadata": {
                                        "sendPost": true,
                                        "apiUrl": "/youtubei/v1/live_chat/moderate"
                                    }
                                },
                                "moderateLiveChatEndpoint": {
                                    "params": "params"
                                }
                            },
                            "icon": {
                                "iconType": "REMOVE_CIRCLE"
                            },
                            "accessibility": {
                                "label": "Hide user on this channel"
                            },
                            "tooltip": "Hide user on this channel",
                            "trackingParams": "trackingParams",
                            "accessibilityData": {
                                "accessibilityData": {
                                    "label": "Hide user on this channel"
                                }
                            }
                        }
                    }
                ],
                "trackingParams": "trackingParams"
            }
        }
    }
}

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 this pull request may close these issues.

2 participants