public VideoConfig(YTResult searchResult, string levelPath) { videoID = searchResult.ID; title = searchResult.Title; author = searchResult.Author; duration = searchResult.Duration; LevelDir = levelPath; }
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); }