本文介绍了Excel VBA查找dd& dt标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从souq .com网站获取数据
I am trying to fetch data from site souq .com
http://saudi.souq.com/sa-en/oneplus-3-dual-sim-64gb-4g-lte-graphite-10880010/i/
来源就是这样,
<div id="specs-full"><dt>Brand</dt><dd>OnePlus</dd>
我正在使用这段代码
spec1 = Trim(Doc.getElementById("specs-full").getElementsByTagName("dt")(0).innerText)
spec2 = Trim(Doc.getElementById("specs-full").getElementsByTagName("dd")(0).innerText)
问题是dd& dt标记,我不知道有多少我正在为许多网址获取数据
problem is that there are many dd & dt tag, and i dont know how many as i am fetching data for many url's
所以我需要找到dd&的数字的代码. dt标签位于"specs-full"标签中
so i need code that find number of dd & dt tag in "specs-full" tag
推荐答案
这样的解决方案如何
Set All_dd = Doc.getElementById("specs-full").getElementsByTagName("dd")
Counter=1
For Each dd In All_dd
Counter=Counter+1
Next
msgbox Counter
此博客介绍了可用于VBA网络抓取的各种技术. http://www.excelvbasolutions.com/2016/02 /web-scraping-collecting-data-from.html
And this blog explains various techniques you can use for VBA webscraping.http://www.excelvbasolutions.com/2016/02/web-scraping-collecting-data-from.html
这篇关于Excel VBA查找dd& dt标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!