예제 #1
0
        private async Task GetCaptions(
            string videoId,
            CancellationToken cancellationToken)
        {
            var captions = await _yt.GetCaptionsAsync(videoId, cancellationToken);

            if (captions == null)
            {
                var name = await _yt.GetEnglishCaptionNameAsync(videoId, cancellationToken);

                _logger.LogInformation("Captions name: {Name}", name);

                if (name == null)
                {
                    return;
                }

                captions = await _yt.GetNamedCaptionsAsync(videoId, name, cancellationToken);
            }

            Texts = captions;
        }