Reputation: 1
So i wanna make a table in Richbox1 like on Screenshoot
and i get the source i mean the text from a website.
The name (article) and price are in the same div
here the Html Code
<article class="aditem" data-adid="1531911601">
<div class="aditem-image">
<div class="imagebox srpimagebox" data-href="/s-anzeige/opel-vivaro-2-0-cdti-84kw-m9r-austauschmotor-einbau-motor/1531911601-280-1651" data-imgsrc="https://i.ebayimg.com/00/s/NDgxWDY0Mw==/z/IIsAAOSwy2Nfe-oK/$_2.JPG" data-imgsrcretina="https://i.ebayimg.com/00/s/NDgxWDY0Mw==/z/IIsAAOSwy2Nfe-oK/$_35.JPG 2x" data-imgtitle="PICTURE" style="cursor: pointer;">
<img src="PICTURE">
</div>
</div>
<div class="aditem-main">
<h2 class="text-module-begin">
<a class="ellipsis" href="Link here example www.example.com/article/example AND I NEED THIS ON NEW LINE ON TABLE LIKE --> NAME | PRICE | LINK TO ARTICLE ">THIS PART I NEED ON FIRST table to Name </a>
</h2>
<p>Descripton here ​..</p>
<p class="text-module-end"></p>
</div>
<div class="aditem-details">
<strong>123 € VB</strong>
<br>
PLZ<br>
Ort/state<br>
</div>
<div class="aditem-addon">
05.12.2020
</div>
</article>
See please the code to understand what i mean
i want the one column for article one for from the article price one from go to the ads link in a text
im not Profi and not Beginner so my codding level is maybe 25 . 30 %
Upvotes: 0
Views: 705
Reputation: 625
You need to install HTMLAgilityPack nuget package into your project.
Then try the following code.
Dim htmlDoc As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
htmlDoc.Load(New StringReader(WebBrowser1.Document.Body.OuterHtml))
If htmlDoc.DocumentNode IsNot Nothing Then
For Each node As HtmlNode In htmlDoc.DocumentNode.SelectNodes("//h2//a")
Dim hrefValue As String = node.GetAttributeValue("href", "")
Dim text As String = node.InnerText
RichTextBox1.Text += text & " | " & hrefValue & vbNewLine
Next
End If
HtmlAgilityPack uses XPath syntax,check: https://www.w3schools.com/xml/xpath_syntax.asp
Upvotes: 0