Exemple #1
0
            public override async ValueTask <bool> MoveNextAsync()
            {
                if (entity == null)
                {
                    if (await TryGetResponse($"https://app-api.pixiv.net/v1/search/user?filter=for_android&word={keyword}") is (true, var model))
                    {
                        entity = model;
                        UpdateEnumerator();
                    }
                    else
                    {
                        throw new QueryNotRespondingException();
                    }

                    Enumerable.ReportRequestedPages();
                }
Exemple #2
0
        public async IAsyncEnumerable <User> MoveNextAsync()
        {
            var url = $"https://app-api.pixiv.net/v1/search/user?filter=for_android&word={keyword}";

            context = (await HttpClientFactory.AppApiHttpClient.GetStringAsync(context == null ? url : context.NextUrl)).FromJson <UserNavResponse>();

            if (context.UserPreviews.IsNullOrEmpty() && counter++ == 0)
            {
                throw new QueryNotRespondingException();
            }

            foreach (var responseUserPreview in context.UserPreviews.Where(u => u != null))
            {
                var usr = new User
                {
                    Avatar     = responseUserPreview.User.ProfileImageUrls.Medium,
                    Thumbnails = responseUserPreview.Illusts.Select(i => i.ImageUrl.SquareMedium).ToArray(),
                    Id         = responseUserPreview.User.Id.ToString(),
                    Name       = responseUserPreview.User.Name
                };
                yield return(usr);
            }
        }