Skip to content

Commit

Permalink
Merge pull request #2 from MurabitoB/dev
Browse files Browse the repository at this point in the history
feat: release 1.1b
  • Loading branch information
MurabitoB authored Jun 10, 2023
2 parents fb47152 + 1368fca commit 15724d6
Show file tree
Hide file tree
Showing 41 changed files with 19,138 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .idea/.idea.VTSYoutubeDropper/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

966 changes: 966 additions & 0 deletions .idea/config/applicationhost.config

Large diffs are not rendered by default.

95 changes: 95 additions & 0 deletions Documents/READEME.ja-JP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# VTS YouTube Emote Dropper

## これは何ですか?

これは[VTube Studio](https://store.steampowered.com/app/1325860/VTube_Studio/)のプラグインであり、YouTube のチャットルームのエモートと投稿者のサムネイルを VTube Studio に表示することができます。

このプラグインは、[VTS Twitch Dropper](https://github.com/DenchiSoft/VTubeStudio/wiki/Twitch-Interaction)のほとんどの機能を継承しています。

_台湾の Vtuber、Chilla Behemes さんのテストに感謝します。_
![https://youtu.be/8UN9Z_cpWFU?t=496](https://i.imgur.com/7Fmg0pl.png)
ストリーム:https://youtu.be/8UN9Z_cpWFU?t=459

## 使い方

### 1. リリースページにアクセスし、最新バージョンのプラグインをダウンロードします。

![](https://i.imgur.com/LQh497E.png)
![](https://i.imgur.com/iQYuTWu.png)

### 2. ZIP ファイルを解凍し、フォルダーを VTube Studio のインストールフォルダーに配置します。

![](https://i.imgur.com/tqObut1.png)
![](https://i.imgur.com/bOpUX6A.png)

**重要:ZIP ファイル内のすべてのファイルを正しいフォルダーに解凍して配置してください。**

### 3. VTube Studio を開き、Twitch にログインします

このプラグインは、VTS Twitch Dropper をベースにしているため、同じ方法で設定できます。

**重要:YouTube Emote Dropper を有効にするためには、まず Twitch Emote Dropper を有効にする必要があります。**

ほとんどのパラメーターは Twitch Dropper から引き継がれます。

![](https://i.imgur.com/SRnRAnZ.png)
![](https://i.imgur.com/3l0rvJ3.png)
![](https://i.imgur.com/IwEOuti.png)
![](https://i.imgur.com/y2T8Sga.png)

### 4. プラグインウィンドウを開く

`DELETE`キーを押してプラグインウィンドウを開く/閉じることができます。

![](https://i.imgur.com/aUoAiQy.png)

例:`https://www.youtube.com/watch?v=8UN9Z_cpWF`

ストリームの URL をプラグインウィンドウにコピーし、[確認]をクリックします。

![](https://i.imgur.com/CfL5gWQ.png)

## 注意事項

重要:

- メンバー限定ストリームはサポートされていません。
- 絵文字(emoji)はサポートされていません。
- スパムを防ぐために、**サムネイルをドロップ**する場合は**メンバー/管理者のみ**を使用することを推奨します。
- 非公開ストリームでテストすることができます。

## Q&A

Q: Twitch と YouTube のエモートドロッパーを同時に使用できますか?

A: はい、可能です。

---

Q: なぜこのプラグインを使用する際に必要な許可が表示されないのですか。

A: このプラグインは、VTube Studio との公式 API 使用していないため、許可が表示されません。

---

Q: Mac でこのプラグインを使用できますか?

A: いいえ、このプラグインは Windows 専用です。

---

Q: これは無料ですか?

A: はい、無料です。

---

Q: このプラグインを変更できますか?

A: プラグインをフォークしたり変更したりすることは自由です。

## 参考文献

[KomeTube](https://github.com/dghkd/KomeTube/tree/master/KomeTube): YouTube のチャットルームメッセージを取得します。

[BepInEx](https://github.com/BepInEx/BepInEx): Unity プラグイン/Modding フレームワーク。
7 changes: 7 additions & 0 deletions Documents/ReleaseNotes/v1.1b/README.ja-JP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#V1.1b

1. チャットの投稿者のサムネイルの表示をできました。
2. メンバーマイルストーンチャット / ギフト / スパチャ のエモートと投稿者のサムネイルの表示をサポートしました。
3. メンバーマイルストーンチャット / ギフト / スパチャ コメントのフィルタリングをサポートしました。
4. 日本語 / 繁體中文 を i18n にサポートしました。
5. エモートの解像度を 128 \* 128px に増やしました。
7 changes: 7 additions & 0 deletions Documents/ReleaseNotes/v1.1b/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# V1.1b

1. Supported displaying chat author thumbnail.
2. Supported displaying member milestone/gift/SC comment emote and author thumbnail.
3. Supported filtering member milestone/gift/SC comments.
4. Supported i18n (zh-TW / ja-JP / en-US).
5. Increase the emote resolution to 128 \* 128px.
45 changes: 39 additions & 6 deletions MurabitoB.Youtube.Core/Kernel/CommentLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ namespace KomeTube.Kernel
{
public class CommentLoader
{

private readonly static string BaseUrl = "www.youtube.com";

// private readonly static string BaseUrl = "localhost:3000";

#region Private Member

private String _videoUrl;
Expand Down Expand Up @@ -137,7 +142,7 @@ public void Stop()
/// <returns>回傳聊天室位址,若失敗則發出CanNotGetLiveChatUrl Error事件,並回傳空字串</returns>
private String GetLiveChatRoomUrl(String videoUrl)
{
const String baseUrl = "www.youtube.com/watch?";
String baseUrl = $"{BaseUrl}/watch?";
String ret = "";
String urlParamStr = videoUrl.Substring(videoUrl.IndexOf(baseUrl) + baseUrl.Length);
String[] urlParamArr = urlParamStr.Split('&');
Expand All @@ -161,7 +166,7 @@ private String GetLiveChatRoomUrl(String videoUrl)
}
else
{
ret = String.Format("https://www.youtube.com/live_chat?v={0}&is_popout=1", vid);
ret = String.Format($"https://{BaseUrl}/live_chat?v={{0}}&is_popout=1", vid);
}

return ret;
Expand All @@ -174,7 +179,7 @@ private String GetLiveChatRoomUrl(String videoUrl)
/// <returns>回傳Youtube API 'get_live_chat'的位址</returns>
private String GetLiveChatUrl(String apiKey)
{
string ret = @"https://www.youtube.com/youtubei/v1/live_chat/get_live_chat?key=" + apiKey;
string ret = $@"https://{BaseUrl}/youtubei/v1/live_chat/get_live_chat?key=" + apiKey;

return ret;
}
Expand Down Expand Up @@ -250,7 +255,8 @@ private void StartGetCommentsCompleted(Task sender, object obj)
/// </summary>
/// <param name="liveChatUrl">聊天室位址</param>
/// <returns>回傳continuation參數值</returns>
private List<CommentData> ParseLiveChatHtml(String liveChatUrl, ref String continuation)
private List<CommentData> ParseLiveChatHtml
(String liveChatUrl, ref String continuation)
{
String htmlContent = "";
List<CommentData> initComments = new List<CommentData>();
Expand Down Expand Up @@ -551,11 +557,27 @@ private List<CommentData> ParseComment(dynamic commentActions)
else
{
dynamic paidMsgRd = JsonHelper.TryGetValueByXPath(commentActions[i], "addChatItemAction.item.liveChatPaidMessageRenderer", null);
if (paidMsgRd == null)
dynamic membershipMsgRd = JsonHelper.TryGetValueByXPath(commentActions[i], "addChatItemAction.item.liveChatMembershipItemRenderer", null);
dynamic gift = JsonHelper.TryGetValueByXPath(commentActions[i], "addChatItemAction.item.liveChatSponsorshipsGiftPurchaseAnnouncementRenderer", null);

if (paidMsgRd != null)
{
ParsePaidMessage(cmt.addChatItemAction.item.liveChatPaidMessageRenderer, paidMsgRd);
}

else if (membershipMsgRd != null)
{
ParseMemberMilestoneMessage(cmt.addChatItemAction.item.liveChatMembershipItemRenderer, membershipMsgRd);
}
else if (gift != null)
{
ParseGiftMessage(cmt.addChatItemAction.item.liveChatSponsorshipsGiftPurchaseAnnouncementRenderer, gift);
}
else
{
continue;
}
ParsePaidMessage(cmt.addChatItemAction.item.liveChatPaidMessageRenderer, paidMsgRd);

}

ret.Add(cmt);
Expand Down Expand Up @@ -583,6 +605,17 @@ private void ParsePaidMessage(LiveChatPaidMessageRenderer liveChatPaidMessageRen
liveChatPaidMessageRenderer.timestampColor = Convert.ToInt64(JsonHelper.TryGetValueByXPath(paidMsgRd, "timestampColor", 0));
}

private void ParseMemberMilestoneMessage(LiveChatMembershipItemRenderer liveChatMembershipItemRenderer, dynamic memberMileStoneRd)
{
ParseTextMessage(liveChatMembershipItemRenderer, memberMileStoneRd);
}

private void ParseGiftMessage(LiveChatSponsorshipsGiftPurchaseAnnouncementRenderer liveChatPaidMessageRenderer, dynamic giftMsgRd)
{
ParseTextMessage(liveChatPaidMessageRenderer, giftMsgRd);
}


/// <summary>
/// 解析留言內容
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions MurabitoB.Youtube.Core/Kernel/YtLiveChatDataModel/CommentData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ public LiveChatPaidMessageRenderer()
public long authorNameTextColor { get; set; }
public long timestampColor { get; set; }
}

public class LiveChatMembershipItemRenderer : LiveChatTextMessageRenderer
{

}

public class LiveChatSponsorshipsGiftPurchaseAnnouncementRenderer : LiveChatTextMessageRenderer
{

}

public class LiveChatTextMessageRenderer
{
Expand Down Expand Up @@ -150,10 +160,15 @@ public Item()
{
this.liveChatTextMessageRenderer = new LiveChatTextMessageRenderer();
this.liveChatPaidMessageRenderer = new LiveChatPaidMessageRenderer();
this.liveChatMembershipItemRenderer = new LiveChatMembershipItemRenderer();
this.liveChatSponsorshipsGiftPurchaseAnnouncementRenderer = new LiveChatSponsorshipsGiftPurchaseAnnouncementRenderer();
}

public LiveChatTextMessageRenderer liveChatTextMessageRenderer { get; set; }
public LiveChatPaidMessageRenderer liveChatPaidMessageRenderer { get; set; }
public LiveChatMembershipItemRenderer liveChatMembershipItemRenderer { get; set; }

public LiveChatSponsorshipsGiftPurchaseAnnouncementRenderer liveChatSponsorshipsGiftPurchaseAnnouncementRenderer { get; set; }

public bool IsPaidMessage
{
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,22 @@ Most of the parameter will inherit from Twitch Dropper.

Press `DELETE` key to open/close the plug-in window.

![](https://i.imgur.com/Z8RAndz.png)
![](https://i.imgur.com/aUoAiQy.png)

EXAMPLE: `https://www.youtube.com/watch?v=8UN9Z_cpWF`

Copy your stream url to the plug-in window and click Confirm.

![](https://i.imgur.com/VshobEL.png)
![](https://i.imgur.com/CfL5gWQ.png)

## Notes

Important:

- Member only stream is not supported.
- Text Emoji is not supported.
- Message in Super Chat is not supported.
- Recommend to use **Member / Admin Only** when using **Drop Thumbnail** to avoid spamming.
- You can test in Unlisted stream.

## Q&A

Expand Down
6 changes: 6 additions & 0 deletions VTSYoutubeDropper.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MurabitoB.Youtube.Core", "M
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VTSYoutubeDropper", "VTSYoutubeDropper\VTSYoutubeDropper.csproj", "{7BA00E0F-1622-40C1-8C16-BE8D855F4584}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VTSYoutubeDropperTestConsole", "VTSYoutubeDropperTestConsole\VTSYoutubeDropperTestConsole.csproj", "{842BFB74-7E27-4F36-880B-2F920E23E255}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -18,5 +20,9 @@ Global
{7BA00E0F-1622-40C1-8C16-BE8D855F4584}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BA00E0F-1622-40C1-8C16-BE8D855F4584}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BA00E0F-1622-40C1-8C16-BE8D855F4584}.Release|Any CPU.Build.0 = Release|Any CPU
{842BFB74-7E27-4F36-880B-2F920E23E255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{842BFB74-7E27-4F36-880B-2F920E23E255}.Debug|Any CPU.Build.0 = Debug|Any CPU
{842BFB74-7E27-4F36-880B-2F920E23E255}.Release|Any CPU.ActiveCfg = Release|Any CPU
{842BFB74-7E27-4F36-880B-2F920E23E255}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 15724d6

Please sign in to comment.