PDA

View Full Version : Extracting links from a web page.



abhshkbtra
18th August 2010, 09:40
I was trying to write a web enabled app using QtWebKit. I couldn't really get from the examples how I could extract link elements from a web page. A small code snippet will be very helpful.

Thanks

Lykurg
18th August 2010, 09:43
Get the HTML of your site and then use a QRegExp to extract the links. There are may examples for the regular expression for extracting links on the web.

abhshkbtra
19th August 2010, 02:50
Thank you for the reply. Is it not possible to use any of the QtWebkit classes to achieve this? In the examples included with Qt Assistant they exhibit dom extraction techniques. I just couldn't figure out how I could use those to search for links on a page based on the text contained between <a> & </a>

Lykurg
19th August 2010, 08:26
You also can use QWebFrame::findAllElements(). there are many ways.