Jump to content

Get META information from website


James
 Share

Recommended Posts

I don't really know Java although I have found code to do it, I was just wondering if it was possible to make one. I currently have this:

#include <Array.au3>
#include <File.au3>
#include <IE.au3>

Global $arLinks[1], $IE

GetLinks("http://www.james-brooks.net")

Func GetLinks($io_Website)
    $IE = _IECreate($io_Website, 0, 0)
    $Links = _IELinkGetCollection($IE); Retrieve all links
    $iNumLinks = @extended; Retrieves the amount
    
;ConsoleWrite("!>Found " & $iNumLinks & " links" & @CRLF)
    For $Link In $Links
        _ArrayAdd($arLinks, $Link.href)
    Next
    
; Output each site and it's link
    $inArray = UBound($arLinks) - 1
    $arLinks[0] = $inArray
    For $i = 0 To $inArray
        ConsoleWrite($arLinks[$i] & @CRLF)
    Next
    _ArrayUnique($arLinks); Delete all duplicate links
    GetMETA()
EndFunc  ;==>GetLinks

Func _ArrayUnique(ByRef $aArray, $vDelim = '', $iBase = 0, $iCase = 0)
    If Not IsArray($aArray) Then Return SetError(1, 0, 0)
    If $vDelim = '' Then $vDelim = Chr(1)
    Local $sHold = ""
    For $iCC = $iBase To UBound($aArray) - 1
        If Not StringInStr($vDelim & $sHold, $vDelim & $aArray[$iCC] & $vDelim, $iCase) Then
            $sHold &= $aArray[$iCC] & $vDelim
        EndIf
    Next
    $sHold = StringTrimRight($sHold, StringLen($vDelim))
    If $sHold And $iBase = 1 Then
        $aArray = StringSplit($sHold, $vDelim)
        Return SetError(0, 0, $aArray)
    ElseIf $sHold And $iBase = 0 Then
        $aArray = StringRegExp($sHold & $vDelim, "(?s)(.+?)" & $vDelim, 3)
        Return SetError(0, 0, $aArray)
    EndIf
    Return SetError(2, 0, 0)
EndFunc

Func GetMETA()
    Local $Title, $Author, $Robots, $Text, $Description
    $Author = _IEGetObjById ($IE, "author")
    Return _IEPropertyGet($Author, "outerhtml")
EndFunc  ;==>GetMETA

Which at the moment retrieves all the links on a page, puts them into an array and deletes all duplicates.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...