c# - How to get specific data using HtmlAgilityPack -
i using htmlagilitypack scrapping data. here link using scrap data this link structure that
<div id="left"> <h2> <i id="bn7483" class="fa fa-volume-up fa-lg in au" title="speak!"/> <span class="in">(dhaarmika) </span> <div class="row"> ...
i need 2 data there 1 "(dhaarmika)" , id "bn7483" using code
htmlagilitypack.htmldocument doc2 = web2.load("http://www.shabdkosh.com/bn/translate/ধার্মিক"); htmlnodecollection nodes = doc2.documentnode.selectnodes("//span[@class='in']");
i able first 1 data "(dhaarmika)".
but couldn't second data.
could tell me how second data???
another possible way selecting preceding sibling of <span>
found :
var doc2 = new htmlweb().load("http://www.shabdkosh.com/bn/translate/ধার্মিক"); var span = doc2.documentnode.selectsinglenode("//span[@class='in']"); var = node.selectsinglenode("preceding-sibling::i[@id]") .attributes["id"] .value;
Comments
Post a Comment