Titre du sujet : Re: Cueillette d'URL par Mytå le 18/11/2012 21:34:11
Re le forum
Pour faire l'extraction des URL contenant 'topic_id=' d'une page web sans doublons.
Option Explicit
' ***************************************
' * Nécessite d'activer les références *
' * Microsoft HTML Objects Library *
' * Microsoft Internet Controls *
' ***************************************
Sub Get_Id()
Dim IE As InternetExplorer
Dim IEDOC As HTMLDocument
Dim Dico As Object
Dim OLink As Object
Dim URL_Adr As String
URL_Adr = "http://www.mdf-xlpages.com/"
Set Dico = CreateObject("Scripting.Dictionary")
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.navigate URL_Adr
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set IEDOC = IE.document
For Each OLink In IEDOC.Links
If InStr(OLink.href, "topic_id=") > 0 Then
Dico(OLink.href) = ""
End If
Next OLink
[A2].Resize(Dico.Count, 1) = Application.Transpose(Dico.keys)
Set IEDOC = Nothing
IE.Quit
Set IE = Nothing
Set Dico = Nothing
End Sub
Mytå
|