public static void Main(string[] args) { Console.WriteLine("========================"); Console.Write("Please enter the URL of the your chosen YT video: "); string URL = Console.ReadLine(); List <string> trackNames = YTRetriever.GetTrackList(URL); string name = YTRetriever.GetVideoTitle(); //TODO: Get the name of the video as well SpotifyCreater.SetPlaylistName(name); SpotifyCreater.Run(trackNames); }
// Obtain List of track name's of the given YT video public static List <string> GetTrackList(string url) { string description = ""; string videoURL = GetVideoID(url); try{ description = new YTRetriever().Run(videoURL).Result; } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { Console.WriteLine("Error: " + e.Message); } } if (description.Length == 0) { //TODO Error handling, for now just exit Console.WriteLine("ERROR: Didnt recieve anything from the YT API"); Environment.Exit(1); } return(GetTrackNames(description)); }