Last active
July 5, 2020 11:34
-
-
Save esnya/255ada66283bacd8418671dec7293c10 to your computer and use it in GitHub Desktop.
テキストファイルからまとめてVideosを設定するやつ。VRC_SyncVideoStream コンポーネントを右クリック。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* VRC Playlist Generator | |
* | |
* Author: esnya | |
* License: MIT License | |
*/ | |
#if UNITY_EDITOR | |
using System.Linq; | |
using UnityEngine; | |
using UnityEditor; | |
using VRCSDK2; | |
public class PlaylistGenerator : EditorWindow | |
{ | |
[MenuItem("CONTEXT/VRC_SyncVideoStream/Load list of URLs from text")] | |
static public void FromMenu(MenuCommand menuCommand) | |
{ | |
var window = EditorWindow.GetWindow(typeof(PlaylistGenerator)) as PlaylistGenerator; | |
window.videoStream = menuCommand.context as VRC_SyncVideoStream; | |
} | |
TextAsset urls; | |
VRC_SyncVideoStream videoStream; | |
void OnGUI() | |
{ | |
urls = EditorGUILayout.ObjectField("URLs (\\n spritted text)", urls, typeof(TextAsset), false) as TextAsset; | |
videoStream = EditorGUILayout.ObjectField("VRC_SyncVideoStream", videoStream, typeof(TextAsset), false) as VRC_SyncVideoStream; | |
var valid = urls != null && videoStream != null; | |
EditorGUI.BeginDisabledGroup(!valid); | |
if (GUILayout.Button("Generate")) { | |
videoStream.Videos = urls.text.Trim().Split('\n').Select(line => { | |
var entry = new VRC_SyncVideoStream.VideoEntry(); | |
entry.URL = line.Trim(); | |
return entry; | |
}).ToArray(); | |
} | |
EditorGUI.EndDisabledGroup(); | |
} | |
} | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// YouTubeのプレイリスト画面でコンソールに入れるとなにかできるかもしれない | |
console.log(Array.from(document.querySelectorAll('ytd-playlist-video-renderer.style-scope > div:nth-child(2) > a:nth-child(1)')).map(a => a.href.replace(/&.*$/, 'g')).join('\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment