Esempio n. 1
0
        private async Task <IVideoList> GetVideoList(YouTubeResponce res)
        {
            var videoIds = new StringBuilder();

            foreach (var id in res.Ids)
            {
                videoIds.AppendLine(id);
                videoIds.AppendLine(",");
            }

            var videos = await GetVideo(videoIds.ToString());

            videos.NextPageToken = res.NextPageToken;
            return(new MVideoList(videos));
        }
Esempio n. 2
0
        private YouTubeResponce GetFirstTimeItems(IEnumerable <string> values, Dictionary <string, IEnumerable <string> > dic)
        {
            dic.Clear();
            var splitted = Split(values);

            for (var i = 0; i < splitted.Count; i++)
            {
                //var pageToken = i + 1;
                dic[i.ToString()] = splitted[i];
            }

            var yt = new YouTubeResponce()
            {
                Ids = dic.Values.First(), NextPageToken = "1"
            };

            return(yt);
        }
Esempio n. 3
0
        private YouTubeResponce GetNextItemsFromDictionary(IReadOnlyDictionary <string, IEnumerable <string> > dic, string nextPageToken)
        {
            IEnumerable <string> value = null;

            if (!dic.TryGetValue(nextPageToken, out value))
            {
                return(null);
            }

            var ids       = dic[nextPageToken];
            int pageToken = 0;

            if (int.Parse(nextPageToken) < dic.Count)
            {
                pageToken = int.Parse(nextPageToken);
                pageToken++;
            }
            var yt = new YouTubeResponce()
            {
                Ids = ids, NextPageToken = pageToken.ToString()
            };

            return(yt);
        }