rediffusion
11/7/2017 - 12:27 PM

Парсинг

Tab Tab1 = instance.ActiveTab;
HtmlElementCollection colPosts = Tab1.FindElementsByXPath("//article");
project.SendInfoToLog(String.Format("Всего найдено постов: {0}", colPosts.Count));

foreach (HtmlElement elPost in colPosts.Elements) {
    project.SendInfoToLog(String.Format("Ссылка на картинку: {0}", elPost.FindChildByXPath(".//descendant::img", 0).GetAttribute("src")));
	project.SendInfoToLog(String.Format("Ссылка на видео: {0}", elPost.FindChildByXPath(".//descendant::video", 0).GetAttribute("src")));
	project.SendInfoToLog(String.Format("Автор: {0}", elPost.FindChildByXPath(".//descendant::a[contains(@class, 'notranslate')]", 0).GetAttribute("InnerHtml")));
	project.SendInfoToLog(String.Format("Время публикации: {0}", elPost.FindChildByXPath(".//descendant::time", 0).GetAttribute("InnerHtml")));
	project.SendInfoToLog(String.Format("Количество просмотров: {0}", elPost.FindChildByXPath(".//descendant::section[1]/descendant::span/span", 0).GetAttribute("InnerHtml")));
}