public async IAsyncEnumerable <R4UCard> Process(IAsyncEnumerable <R4UCard> originalCards) { await foreach (var card in originalCards) { yield return(card); Log.Information("Getting possible foils for [{serial}]", card.Serial); var urlRequest = new FlurlRequest(foilSearchURL).SetQueryParam("keyword", card.Serial); Log.Debug("URL: {url}", urlRequest.Url); var doc = await urlRequest.GetHTMLAsync(); var cardList = doc.QuerySelectorAll(".cardlist-item").Select(i => i as IHtmlAnchorElement).Skip(1); foreach (var cardLink in cardList) { Log.Information("Found URL: {url}", cardLink.Href); var cardLinkDoc = await cardLink.Href.WithReferrer(urlRequest.Url.Path).GetHTMLAsync(); var newCard = card.Clone(); newCard.NonFoil = card; newCard.Serial = cardLinkDoc.QuerySelector(".cardlist-number").TextContent; newCard.Rarity = cardLinkDoc.QuerySelectorAll(".cardlist-text") // .Where(i => i.Children.ElementAt(2)?.TextContent == "レアリティ") .Select(i => i.Children.ElementAt(3).TextContent.Trim()) .First(); yield return(newCard); } } }