public override bool VerifyRationality(Illustration item, IList <Illustration> collection) { return(item != null && collection.All(t => t.Id != item.Id) && PixivHelper.VerifyIllustRational(Settings.Global.ExcludeTag, Settings.Global.IncludeTag, Settings.Global.MinBookmark, item)); }
public async IAsyncEnumerable <Illustration> MoveNextAsync() { const string query = "/v1/illust/recommended"; context = (await HttpClientFactory.AppApiHttpClient.GetStringAsync(context == null ? query : context.NextUrl)).FromJson <RankingResponse>(); foreach (var contextIllust in context.Illusts.Where(illustration => illustration != null)) { var illust = await PixivHelper.IllustrationInfo(contextIllust.Id.ToString()); if (illust != null) { yield return(illust); } } }
public async IAsyncEnumerable <Illustration> MoveNextAsync() { var works = await HttpClientFactory.PublicApiService.QueryWorks(new QueryWorksRequest { Tag = tag, Offset = currentIndex++ }); if (currentIndex - start == 1 && !works.ToResponse.Any()) { throw new QueryNotRespondingException(); } foreach (var response in works.ToResponse.Where(response => response != null)) { var illust = await PixivHelper.IllustrationInfo(response.Id.ToString()); if (illust != null) { yield return(illust); } } }
public async IAsyncEnumerable <Illustration> MoveNextAsync() { var works = await HttpClientFactory.PublicApiService.GetUploads(uid, new UploadsRequest { Page = currentIndex++ }); if (currentIndex == 2 && !works.ToResponse.Any()) { throw new QueryNotRespondingException(); } foreach (var response in works.ToResponse.Where(illustration => illustration != null)) { var illust = await PixivHelper.IllustrationInfo(response.Id.ToString()); if (illust != null) { yield return(illust); } } }
public async IAsyncEnumerable <Illustration> MoveNextAsync() { const string url = "https://app-api.pixiv.net/v2/illust/follow?restrict=public"; var response = (await HttpClientFactory.AppApiHttpClient.GetStringAsync(context == null ? url : context.NextUrl)).FromJson <UserUpdateResponse>(); if (response.Illusts.IsNullOrEmpty() && context == null) { throw new QueryNotRespondingException(); } context = response; foreach (var illust in context.Illusts) { var res = await PixivHelper.IllustrationInfo(illust.Id.ToString()); if (res != null) { yield return(res); } } }
public async IAsyncEnumerable <Illustration> MoveNextAsync() { var query = $"/v1/user/bookmarks/illust?user_id={uid}&restrict=public&filter=for_ios"; var model = (await HttpClientFactory.AppApiHttpClient.GetStringAsync(context == null ? query : context.NextUrl)).FromJson <GalleryResponse>(); if (context == null && model.Illusts.IsNullOrEmpty()) { throw new QueryNotRespondingException(); } context = model; foreach (var contextIllust in context.Illusts.Where(contextIllust => contextIllust != null)) { var illust = await PixivHelper.IllustrationInfo(contextIllust.Id.ToString()); if (illust != null) { yield return(illust); } } }
public static async Task Parse(string url) { Match match; if ((match = Regex.Match(url, IllustRegex)).Success) { var i = MainWindow.Instance; await i.Invoke(async() => { if (i.IllustBrowserDialogHost.IsOpen) { i.IllustBrowserDialogHost.CurrentSession.Close(); } i.OpenIllustBrowser(await PixivHelper.IllustrationInfo(match.Groups["id"].Value), false); }); } else if ((match = Regex.Match(url, UserRegex)).Success) { var i = MainWindow.Instance; i.Invoke(() => { i.SetUserBrowserContext(new User { Id = match.Groups["id"].Value }); i.OpenUserBrowser(); }); } else if ((match = Regex.Match(url, SpotlightRegex)).Success) { var articleId = match.Groups["id"].Value; string title; // if the current culture is set to en-XX, then we will simply analyze the html and get the title if (CultureInfo.CurrentCulture.Name.ToLower().StartsWith("en")) { title = await TryGetSpotlightEnTitle(articleId); } else // otherwise, we will try to access the spotlight web API, and analyze html if failed { try { title = (await HttpClientFactory.WebApiService().GetSpotlightArticles(articleId)).BodyList[0] .Title; } catch (ApiException e) { if (e.StatusCode == HttpStatusCode.NotFound) { title = await TryGetSpotlightEnTitle(articleId); } else { throw; } } } var tasks = await Tasks <string, Illustration> .Of(await PixivClient.Instance.GetArticleWorks(articleId)) .Mapping(PixivHelper.IllustrationInfo) .Construct() .WhenAll(); var result = tasks.Peek(i => { i.IsManga = true; i.FromSpotlight = true; i.SpotlightTitle = title; }).ToArray(); MainWindow.Instance.Invoke(() => MainWindow.Instance.OpenIllustBrowser( result[0].Apply(r => r.MangaMetadata = result.ToArray()), false));