auto 发表于 2014-6-7 13:09:43

请问该正则要如何写(如何从网页提取链接)?

正则一直没有掌握。。又来麻烦大家了,麻烦太多了,放不下。给个链接
http://audiojungle.net/category/music-packs

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



提取<h3> 中间的链接和名字</h3>,不是<H3>中间的链接不要
结果:
链接: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
...

###################################################
       </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>
#####################################################

kevinch 发表于 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不如试下这个

shqf 发表于 2014-6-9 16:56:19

正则的方法,如下试试:
(?i)<h3>\s*<a href="(.+?)">(.+?)</a>
页: [1]
查看完整版本: 请问该正则要如何写(如何从网页提取链接)?