【问题标题】:How to selector a code of some of the same code in WP Web Scraper?如何在 WP Web Scraper 中选择一些相同代码的代码?
【发布时间】:2016-09-11 17:38:24
【问题描述】:

我使用WP Web Scraper 从以下链接中获取标题: http://lpse.acehtenggarakab.go.id/eproc/lelang/view/1316330

标题是:PENGAWASAN/SUPERVISI KEGIATAN FISIK TAHUN 2016

标题位于<td> html 标记内,其属性为class="horizLine"(它位于此html <table> 的第二行(<tr> html 标记),包含 68 行)。

我的 WP Web Scraper 短代码是:

[wpws url="http://lpse.dephub.go.id/eproc/lelang/view/33737114" selector=".horizLine"]

但它不起作用。

我的问题:
如何在我的简码的 selector 属性中定位此标题,而其他人忽略?

【问题讨论】:

    标签: php html css wordpress css-selectors


    【解决方案1】:

    我认为您需要在短代码 selector 属性中添加更多元素,因为显示的 html 源代码是:

    <tr>
        <td width="150" class="TitleLeft">Kode Lelang</td>
        <td colspan="3" class="horizLine"><b>1316330</b></td>
    </tr>
    <tr>
        <td class="TitleLeft">Nama Lelang </td>
        <td colspan="3" class="horizLine">
            <b>
                <strong>PENGAWASAN/SUPERVISI KEGIATAN FISIK TAHUN 2016</strong>
            </b>
        </td>
    </tr>
    <tr> …
    

    这里是定位标题的解决方案是selector="tr:nth-child(2) td.horizLine b strong"

    [wpws url="http://lpse.dephub.go.id/eproc/lelang/view/33737114" selector="tr:nth-child(2) td.horizLine b strong"]
    

    对于:nth-child(2),我的目标是第二个&lt;tr&gt; html 元素。

    【讨论】:

      猜你喜欢
      • 2015-03-20
      • 2016-05-12
      • 2013-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-06
      • 1970-01-01
      相关资源
      最近更新 更多