Exemplo n.º 1
0
        public async Task <IEnumerable <YouTubeAudioDto> > GetAllAudiosAsync(string youtubeUrl)
        {
            //define the Dto list which will be returned to the caller
            var audios = new List <YouTubeAudioDto>();

            //get all videos and audios
            var videosAudios = await youtube.GetAllVideosAsync(youtubeUrl);

            //filter and get only the audios descending ordered by resolution
            videosAudios.Where(x => x.AdaptiveKind == AdaptiveKind.Audio)
            .OrderByDescending(x => x.AudioBitrate)
            .ToList()
            .ForEach(audio => audios.Add(new YouTubeAudioDto(audio)));

            return(audios);
        }
        public async static Task <IEnumerable <VideoInfo> > GetDownloadUrlsAsync(
            string videoUrl, bool decryptSignature = true)
        {
            var videos = await Service
                         .GetAllVideosAsync(videoUrl)
                         .ConfigureAwait(false);

            return(videos.Select(v => new VideoInfo(v)));
        }
Exemplo n.º 3
0
        public virtual async Task <IEnumerable <YouTubeVideo> > GetAllAvailableFormatAsync(string input)
        {
            YouTube youtube = YouTube.Default;

            return(await youtube.GetAllVideosAsync(input));
        }