You are looking for a html parser...(I don't know any easy and reliable html parser for c++)
anyway you can use qwebpage for that... (it's easy and reliable... but thats is not his purposal -> not efficient/not fast for that)
- Get the HTML from a webpage without loading all the medias and stuff.
QWebSettings * settings = QWebSettings::globalSettings();
settings->setAttribute(QWebSettings::AutoLoadImages, false);
settings->setAttribute(QWebSettings::JavascriptEnabled, false);
settings->setAttribute(QWebSettings::JavaEnabled, false);
settings->setAttribute(QWebSettings::PluginsEnabled, false);
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled , true);
- Extract a given Div from its id.
QWebFrame * frame;
QWebElementCollection elems;
QWebElement elem;
frame = page.mainFrame();
elem = frame->findFirstElement("div.tabContent h1"); // css selector !! extremely powerful.
OR
elems = frame->findAllElements("table#myId tbody tr");
and then -> elem.toPlainText()
Bookmarks