public ActionResult Download(string ids) { var videosIds = ids.Split(',').ToList(); var index = 1; foreach (var id in videosIds) { var url = $"https://www.youtube.com/watch?v={ id }"; try { IEnumerable <VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(url); YouTubeDownload.DownloadVideo(videoInfos, index); index++; } catch (Exception ex) { return(Json(new { Message = ex.Message, Status = "Erro" }, JsonRequestBehavior.AllowGet)); } } return(Json(new { Message = "OK", Status = "Sucesso" }, JsonRequestBehavior.AllowGet)); }
private static async void Audio(object o) { Data data = (Data)o; FileInfo info = await YouTubeDownload.DownloadAudioAsync(data.chatId, data.user, data.videoId, data.title); }