Get Link from Cell in Row relative to Text Presense

microvb

Новичок
Регистрация
01.07.2012
Сообщения
7
Благодарностей
0
Баллы
1
Wondering if someone could help with this as I seem to be having a brain fart.

The problem:
I would like to get a URL from the first cell of a row where the text presence of the third cell matches BLAH.

The HTML to search within.

Код:
<table>
<tr class="row">
<td><a href="?123444">123444</td>
<td>Some info</td>
<td>Some more text</td>
</tr>

<tr class="row">
<td><a href="?111111">111111</td>
<td>Some info</td>
<td>BLAH</td>
</tr>

<tr class="row">
<td><a href="?47387483">47387483</td>
<td>Some info</td>
<td>Some more text</td>
</tr>

<tr class="row">
<td><a href="?378278321">378278321</td>
<td>Some info</td>
<td>Some more text</td>
</tr>

</table>
Expected Result:
The link returned should be "?1111111" since "BLAH" is the contents of the third cell in that table row.

Thanks.
 

microvb

Новичок
Регистрация
01.07.2012
Сообщения
7
Благодарностей
0
Баллы
1
Sorry, there was a syntax error in my post. All "<a>" tags are properly closed. See below.

Код:
<table>
<tr class="row">
<td><a href="?123444">123444</a></td>
<td>Some info</td>
<td>Some more text</td>
</tr>

<tr class="row">
<td><a href="?111111">111111</a></td>
<td>Some info</td>
<td>BLAH</td>
</tr>

<tr class="row">
<td><a href="?47387483">47387483</a></td>
<td>Some info</td>
<td>Some more text</td>
</tr>

<tr class="row">
<td><a href="?378278321">378278321</a></td>
<td>Some info</td>
<td>Some more text</td>
</tr>

</table>
 

drvosjeca

Client
Регистрация
26.10.2011
Сообщения
512
Благодарностей
455
Баллы
63
what you need is regex, which will point out and compare third cell like you wanna do, and grab matching line... from matching line then it is easy to get first cell
 

microvb

Новичок
Регистрация
01.07.2012
Сообщения
7
Благодарностей
0
Баллы
1
Thank you for your reply.

What I have setup so far in a new project is as follows (as it seems ZennoPoster 4 is just a smidge more powerful than v3 -- thankfully ^.^):

(START) --> Go to URL
|
Take DOM --- settings (Which tab: Active, Result (checked), Regex: <tr\ class='row'[\w\W]*</tr> , What to take: All, Put result to list: table-rows)
|
Count of Lines --- settings ( table-rows, Get rows count, Put to variable: tablerowcount)


I am really liking the changes in the new ZennoPoster. Much faster, and definitely a lot cleaner in appearance, and the templates are not as bulky.

Continuing to work at this, and will post project on complete in this thread :-)
 

drvosjeca

Client
Регистрация
26.10.2011
Сообщения
512
Благодарностей
455
Баллы
63
yeah, putting to the list is one of the ways, but it gives you extra step

i would preffere making regex which will give you right row straight away, and then you just need one more regex to get a cell you need out...

for example, if you put your regex this way, you will get just a line with "BLAH" inside as result: <tr\ class="row">\r\n.*\r\n.*\r\n.*BLAH.*[\w\W]*?</tr>

you just need to change that blah with variable of what are you looking for ;-)

You can turn this regex around in many different ways, this is just fast example i made, but it works in your example case...
 
  • Спасибо
Реакции: microvb

microvb

Новичок
Регистрация
01.07.2012
Сообщения
7
Благодарностей
0
Баллы
1
THANK YOU !!!

That is how I was doing it before.... totally forgot that method. Still going to use the table to store the array of results to loop through and click. Making these into baby step projects so that they can run better asynchronously.

Aka -- a wordpress account builder + email link grabber + link clicker.

I know they can all be done from within the same project as I was doing with v3, however, if done separately, then that leaves room for switching up the method in that specific script, or improving it, while the others are still running 24/7 :-)

Once this is nailed, I will be improving on E-mail Master to have better integration with this. For example, E-mail master could grab the links from all E-mail accounts using a "smart filter" and act as the "email link grabber" script.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)