Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to selector a code of some of the same code in WP Web Scraper?

I use WP Web Scraper to take the title from the following link : http://lpse.acehtenggarakab.go.id/eproc/lelang/view/1316330

The title is: PENGAWASAN/SUPERVISI KEGIATAN FISIK TAHUN 2016

The title is inside a <td> html tag with an attribute class="horizLine" (It is located on the second line (<tr> html tag) of this html <table> that contains 68 lines).

My WP Web Scraper shorthcode is:

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

But It doesn't work.

My Question:
How can I target this title in the selector attribute of my shortcode, while others ignored?

like image 405
PUSTAKAKORAN.COM Avatar asked Oct 19 '22 09:10

PUSTAKAKORAN.COM


1 Answers

I think you need to add some more elements in your shortcode selector attribute, because the displayed html source is:

<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> …

Here is the solution to target the title is 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"]

With :nth-child(2) I am targeting the 2nd <tr> html element.

like image 119
LoicTheAztec Avatar answered Nov 01 '22 14:11

LoicTheAztec