|
|
|
|
|
|
|
|
|
Home > Software > Link Extractor
|
|
|
|
|
Download LinkExtractor-executables.zip - 194.5 KB
Download LinkExtractor-project.zip - 136.7 KB (Open Source)
|
Link Extractor Introduction
|
Link Extractor is a program that extracts all the links from a web page you specify and lists them in left-bottom-pane. And this program shows the source of the webpage to you in right pane.
Nowadays, Link Extractor is usually used as one of SEO tools in the Internet. I hope this tool shoulde help you when your webpages go to SEO. Link Extractor is a freeware.
|
Using the code in Link Extractor
|
To get HTML Document, GetHtmlDocument() is used.
m_pHTMLDocument3 = GetHtmlDocument();
To extract links from a web page
m_pHTMLDocument3 = GetHtmlDocument();
((CMainFrame*)AfxGetMainWnd())->GetLinkListView()->GetListCtrl().DeleteAllItems();
m_pCollection = m_pHTMLDocument3->getElementsByTagName(L"A");
for(long i=0; ilength; i++)
{
m_pElement = m_pCollection->item(i, (long)0);
if(m_pElement != NULL)
{
//second parameter says that you want to get text inside attribute as is
BSTR bstr; CString str;
m_pElement->get_innerText( &bstr );
str = bstr;
((CMainFrame*)AfxGetMainWnd())->GetLinkListView()->AddLink(
(LPCTSTR)bstr_t(m_pElement->getAttribute("href", 2)),
(LPCTSTR)bstr_t(m_pElement->getAttribute("title", 2)),
str.operator LPCTSTR()
);
}
To get the html source from a web page
IHTMLDocument2 *lpHtmlDocument = NULL;
LPDISPATCH lpDispatch = NULL;
lpDispatch = GetHtmlDocument();
if(!lpDispatch)
return false;
lpDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&lpHtmlDocument);
ASSERT(lpHtmlDocument);
lpDispatch->Release();
IHTMLElement *lpBodyElm;
IHTMLElement *lpParentElm;
lpHtmlDocument->get_body(&lpBodyElm);
ASSERT(lpBodyElm);
lpHtmlDocument->Release();
// the parent of Body is HTML
lpBodyElm->get_parentElement(&lpParentElm);
ASSERT(lpParentElm);
BSTR bstr;
CString str;
lpParentElm->get_outerHTML(&bstr);
str = bstr;
((CMainFrame*) AfxGetMainWnd())->GetHttpSourceView()->AddSource( str );
lpParentElm->Release();
lpBodyElm->Release();
|
Other Version Download
DOWNLOAD Link Extractor Open Source
|
|
|
|
|
|
|
|
|
|
|
|