找回密码
 加入
搜索
查看: 2137|回复: 2

[效率算法] 请问该正则要如何写(如何从网页提取链接)?

[复制链接]
发表于 2014-6-7 13:09:43 | 显示全部楼层 |阅读模式
正则一直没有掌握。。又来麻烦大家了,麻烦太多了,放不下。给个链接
http://audiojungle.net/category/music-packs

如何获取上面的每个子面页的链接?



提取  <h3> 中间的链接和名字</h3>,不是<H3>中间的链接不要
结果:
链接:http://audiojungle.net/item/insp ... search_item&amp;WT.oss_phrase=film&amp;WT.oss_rank=21&amp;WT.z_author=BeautifulNotes
名字:Inspiring Film Score
...

###################################################
       </li>
  </ul>
</div>
  </div>

    <div class="item-info">
      <h3>
        <a href="http://audiojungle.net/item/inspiring-film-score/7685756?WT.ac=search_item&amp;WT.oss_phrase=film&amp;WT.oss_rank=21&amp;WT.z_author=BeautifulNotes">Inspiring Film Score</a>
      </h3>

      <a href="/user/BeautifulNotes?WT.ac=search_profile&amp;WT.z_author=BeautifulNotes" class="author">BeautifulNotes</a>

          </div>

    <small class="meta">
        <span class="meta-categories">in
<a href="http://audiojungle.net/category/music">Music</a>

<a href="http://audiojungle.net/category/music/cinematic" itemprop="genre">Cinematic</a>
</span><br />
      Bit Rate: 320 kbps, Length: 6:14, Looped Audio: No, Sample Rate: 16-Bit Stereo, 44.1 kHz    </small>

    <div class="sale-info">
      <div class="rating">
        <div class="rating-basic">
</div>      </div>
      <small class="sale-count">0 Sales</small>
      <small class="price">$17</small>


    </div>


</li>
#####################################################
发表于 2014-6-7 17:05:21 | 显示全部楼层
#include <ie.au3>

$oie=_IECreate("http://audiojungle.net/category/music-packs",1,1,1,0)
Do
        _IELoadWait($oie,500)
        For $h3 In $oie.document.getelementsbytagname("h3")
                $link=$h3.getelementsbytagname("a").item(0)
                ConsoleWrite($link.href&@TAB&$link.innertext&@CRLF)
        Next
Until _IELinkClickByText($oie,"NEXT")=0
不如试下这个
发表于 2014-6-9 16:56:19 | 显示全部楼层
正则的方法,如下试试:
(?i)<h3>\s*<a href="(.+?)">(.+?)</a>
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-6 11:50 , Processed in 0.075780 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表