如何提取电子邮件地址

How to extract email address

Private Sub CommandButton2_Click()

    Dim ie, items, elem As Object
    Dim i, j, k, l As Integer

    i = 2
    k = 2
    l = 2

    Set ie = CreateObject("Internetexplorer.application")

    ie.Visible = True

    ie.navigate "https://www.amazon.com/gp/pdp/profile/A3NEAETOSXDBOM/"

    Do While ie.busy Or ie.readystate <> 4

    Loop

    For i = 0 To 500
        On Error Resume Next

        Range("A" & i).Value = ie.document.getelementsbytagname("a").Item(i).innertext

    Next i

End Sub

我正在寻找在页面左侧显示为“发送电子邮件”的电子邮件地址,点击它后会出现电子邮件地址。

注意:您必须登录才能查看“发送电子邮件”选项。

在 End Sub 之前添加以下代码:

Set sendAnEmail = ie.Document.getElementsByClassName("a-link-normal pr-email").Item(0)

sendAnEmail.Click  

Application.Wait Now + TimeSerial(0, 0, 2)

retrievedEmail = sendAnEmail.innerText

MsgBox retrievedEmail

但是,您应该看看亚马逊关于网络抓取的政策,因为这不可能 100% 合法