Youtube の Live配信からMinecraft Serverにコマンドを送信します。
また、CallBackメソッドを変更することで任意のサーバに対してHTTPリクエストを送信することができます。
command フォルダの中身のClassを拡張することで送信内容を変更することができます。
- textMessage
- 通常のチャットメッセージ
- superSticker
- スーパースティッカー
- superChat
- スーパチャット
- newSponsor
- 新規メンバー登録
- giftRedemption
- メンバーシップギフト受け取り
- giftPurchase
- メンバーシップギフト送信
なんかDemo動画か何か作って To赤石さん
Python 3
pychat をもとに作成されています。
初めにConst.py の YOUTUBE_VIDEO_ID に
対象の動画IDを入力します。(https://www.youtube.com/watch?v=XXXXXXXXXXX) XXXXXの部分
Youtubeメッセージを受信すると
Commandパッケージ直下にある、Classが呼び出されます。
data format
| name | type | remarks |
|---|---|---|
| type | str | "superChat","textMessage","superSticker","newSponsor" |
| id | str | |
| message | str | emojis are represented by ":(shortcut text):" |
| messageEx | str | list of message texts and emoji dicts(id, txt, url). |
| timestamp | int | unixtime milliseconds |
| datetime | str | e.g. "2019-10-10 12:34:56" |
| elapsedTime | str | elapsed time. (e.g. "1:02:27") *Replay Only. |
| amountValue | float | e.g. 1,234.0 |
| amountString | str | e.g. "$ 1,234" |
| currency | str | ISO 4217 currency codes (e.g. "USD") |
| bgColor | int | RGB Int |
| author | object | see below |
Structure of author object.
| name | type | remarks |
|---|---|---|
| name | str | |
| channelId | str | *chatter's channel ID. |
| channelUrl | str | |
| imageUrl | str | |
| badgeUrl | str | |
| isVerified | bool | |
| isChatOwner | bool | |
| isChatSponsor | bool | |
| isChatModerator | bool |
{
"id": 1,
"videoId": "XXXXXXXXXXX",
"channelName": "Channnel Name",
"userId": "32-character fixed-length UUID",
"data": {
"author": {
"badgeUrl": "",
"type": "",
"isVerified": false,
"isChatOwner": false,
"isChatSponsor": false,
"isChatModerator": false,
"channelId": "000000000000000000000000",
"channelUrl": "http://www.youtube.com/channel/UCqVDpXKLmKeBU_yyt_QkItQ",
"name": "YouTube system message",
"imageUrl": "https://yt3.ggpht.com/584JjRp5QMuKbyduM_2k5RlXFqHJtQ0qLIPZpwbUjMJmgzZngHcam5JMuZQxyzGMV5ljwJRl0Q=s66-c-k-c0x00ffffff-no-rj"
},
"type": "textMessage",
"id": "variable length UUID",
"timestamp": 1667061815386,
"elapsedTime": "",
"datetime": "2022-10-30 01:43:35",
"message": "HELLO WORLD",
"messageEx": [
"HELLO WORLD"
],
"amountValue": 0,
"amountString": "",
"currency": "",
"bgColor": 0
}
}pip install -r requirements.txt
python client_main.py
このプログラムは研究目的のためのものです。研究・教育用途のみにてお使いください。これらを利用したことにより生じた責任は負いかねます
