我有一个网站,可以从中提取数据,但由于 URL 格式不正确,因此我在提取图像时遇到了问题。需要建议以正确的格式提取 URL...
我有一个可以从中提取数据的网站,但由于 URL 格式不正确,我在提取图像时遇到了问题。需要建议以正确的格式提取 URL。我的工作代码如下,但输出 URL 不正确。页面 URL 是 \'https://tjmaxx.tjx.com/store/jump/product/Waterproof-Hiking-Boots/1000935805?rrec=true&cs=PDP\'
我的以下代码是提取图像,但网址不正确
Dim imgs As String
imgs = d.FindElementByXPath("/html/body/div[4]/div/div/div[2]/section/div[1]/div[1]/ div").Attribute("innerHTML")
If imgs = "" Then
imgs = d.FindElementByXPath("/html/body/div[2]/div/div/div[2]/section/div[1]/div[1]/div").Attribute("innerHTML")
End If
'MsgBox (imgs)
img = CountChrInString(imgs, "img src")
'MsgBox (img)
For i = 1 To img
img1 = d.FindElementByXPath("/html/body/div[4]/div/div/div[2]/section/div[1]/div[1]/div/ul/li[" & i & "]/a/img").Attribute("src")
If img1 = "" Then
img1 = d.FindElementByXPath("/html/body/div[2]/div/div/div[2]/section/div[1]/div[1]/div/ul/li[" & i & "]/a/img").Attribute("src")
End If
If imgall = "" Then
imgall = img1
Else
imgall = imgall & "," & img1
End If
Next