Results 1 to 8 of 8

Thread: Webkit: extract information from HTML

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Posts
    74
    Thanks
    2
    Thanked 6 Times in 6 Posts

    Default Re: Webkit: extract information from HTML

    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()
    Last edited by javimoya; 29th December 2010 at 15:52.

Similar Threads

  1. Replies: 1
    Last Post: 29th April 2011, 23:50
  2. Replies: 4
    Last Post: 23rd September 2010, 15:20
  3. get html tag by clicking (webkit)
    By billconan in forum Qt Programming
    Replies: 0
    Last Post: 23rd June 2009, 22:07
  4. Qt 4.4 WebKit: WYSIWYG HTML editor?
    By 24pm in forum Qt Programming
    Replies: 6
    Last Post: 13th March 2009, 10:08
  5. QWebView Extract Information
    By tpf80 in forum Qt Programming
    Replies: 2
    Last Post: 23rd October 2008, 01:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.