Exemple #1
0
        /// <summary>
        /// Initializes an instance of <see cref="VideoClient"/>.
        /// </summary>
        internal VideoClient(YoutubeHttpClient httpClient)
        {
            _httpClient = httpClient;

            Streams        = new StreamsClient(httpClient);
            ClosedCaptions = new ClosedCaptionClient(httpClient);
        }
Exemple #2
0
 public SegmentedHttpStream(YoutubeHttpClient httpClient, string url, long length, long segmentSize)
 {
     _url         = url;
     _httpClient  = httpClient;
     Length       = length;
     _segmentSize = segmentSize;
 }
 /// <summary>
 /// Initializes an instance of <see cref="YoutubeClient"/>.
 /// </summary>
 internal YoutubeClient(YoutubeHttpClient httpClient)
 {
     Videos    = new VideoClient(httpClient);
     Playlists = new PlaylistClient(httpClient);
     Channels  = new ChannelClient(httpClient);
     Search    = new SearchClient(httpClient);
 }
Exemple #4
0
        public static async Task <ChannelPage> GetByUserNameAsync(YoutubeHttpClient httpClient, string userName) =>
        await Retry.WrapAsync(async() =>
        {
            var url = $"https://www.youtube.com/user/{userName}?hl=en";
            var raw = await httpClient.GetStringAsync(url);

            var result = Parse(raw);

            if (!result.IsOk())
            {
                throw TransientFailureException.Generic("Channel page is broken.");
            }

            return(result);
        });
 /// <summary>
 /// Initializes an instance of <see cref="StreamsClient"/>.
 /// </summary>
 internal StreamsClient(YoutubeHttpClient httpClient)
 {
     _httpClient = httpClient;
 }
Exemple #6
0
 /// <summary>
 /// Initializes an instance of <see cref="ClosedCaptionClient"/>.
 /// </summary>
 internal ClosedCaptionClient(YoutubeHttpClient httpClient)
 {
     _httpClient = httpClient;
 }
Exemple #7
0
 /// <summary>
 /// Initializes an instance of <see cref="SearchClient"/>.
 /// </summary>
 internal SearchClient(YoutubeHttpClient httpClient)
 {
     _httpClient = httpClient;
 }
Exemple #8
0
 public static async Task <PlayerSource> GetAsync(YoutubeHttpClient httpClient, string url) =>
 await Retry.WrapAsync(async() =>
 {
     var raw = await httpClient.GetStringAsync(url);
     return(Parse(raw));
 });
Exemple #9
0
 /// <summary>
 ///     Initializes an instance of <see cref="PlaylistClient" />.
 /// </summary>
 internal PlaylistClient(YoutubeHttpClient httpClient)
 {
     _httpClient = httpClient;
 }
Exemple #10
0
 /// <summary>
 ///     Initializes an instance of <see cref="YoutubeClient" />.
 /// </summary>
 internal YoutubeClient(YoutubeHttpClient httpClient)
 {
     Videos    = new VideoClient(httpClient);
     Playlists = new PlaylistClient(httpClient);
 }
Exemple #11
0
        /// <summary>
        ///     Initializes an instance of <see cref="VideoClient" />.
        /// </summary>
        internal VideoClient(YoutubeHttpClient httpClient)
        {
            _httpClient = httpClient;

            Streams = new StreamsClient(httpClient);
        }
 /// <summary>
 /// Initializes an instance of <see cref="ChannelClient"/>.
 /// </summary>
 internal ChannelClient(YoutubeHttpClient httpClient)
 {
     _httpClient = httpClient;
 }