Exemplo n.º 1
0
        public VideoConfig(YTResult searchResult, string levelPath)
        {
            videoID  = searchResult.ID;
            title    = searchResult.Title;
            author   = searchResult.Author;
            duration = searchResult.Duration;

            LevelDir = levelPath;
        }
Exemplo n.º 2
0
        private static YTResult?ParseSearchResult(string searchResultJson)
        {
            if (!(JsonConvert.DeserializeObject(searchResultJson) is JObject result))
            {
                Log.Error("Failed to deserialize " + searchResultJson);
                return(null);
            }

            if (result["id"] == null)
            {
                Log.Warn("YT search result had no ID, skipping");
                return(null);
            }

            var ytResult = new YTResult(result);

            return(ytResult);
        }