<a class="product-name" href="http:xyz" title="Polac pineapple slices 3kg">Polac pineapple slices 3kg</a> <div class="price-box"> <span class="regular-price" id="product-price-5489"> <span class="price">Rs 665</span> </span>
1つのHTMLタグが一致する場合、別のタグがhtmlagilitypack
を使用してクロールする必要があるが、一致したとき、それは、特定のアイテムの価格を提供する必要があります。タグはPolacパイナップルなどの内部テキストを持っている場合のように、それは以下のルピー665 を返す必要があります私はあなたがより正確にできます
`
var aTags = document.DocumentNode.SelectNodes("//a");
var nextTags = document.DocumentNode.SelectNodes("//span");
if (aTags != null)
{
foreach (var aTag in aTags)
{
s += counter + ". " + aTag.InnerText + "<br>";
//s += aTag.InnerText;
if (aTag.InnerText == "Polac pineapple")
{
brandcheck = true;
find += aTag.InnerText + " ";
foreach (var nextTag in nextTags)
{
//s += counter + ". " + nextTag.InnerText + "<br>";
s += nextTag.InnerText;
if (nextTag.InnerText.Contains("Rs"))
{
brandcheck = true;
find = nextTag.InnerText + " ";
}
}`
サンプルコードを追加できますか? – ChrisBint
@ChrisBintチェックアウト、コードを追加しました! –