Make variable of next result after text found

ZeroCouponBond

Новичок
Регистрация
25.09.2012
Сообщения
12
Благодарностей
0
Баллы
0
I have some profilepages i want to scrape. But how the tables look like depends on what information there is on the profilepage. So if i just scrape everything, the output from the scraping will be written in different columns every time. If regex find the text "Phone", I need to write "12345" in column 1. But if Phone is missing, I need to it to just write "0".


</tr>
<tr>
<td>Phone</td>
<td>12345</td>
</tr>
<tr>
<td>Name</td>
<td>ABCDE</td>
</tr>

But if Phone is missing, it looks like this:

<tr>
<td>Name</td>
<td>ABCDE</td>
</tr>

I then need "0" in column 1 and then "ABCDE" in column 2. Since all the results I want is between <td> and </td>, I need to decide what result it is based on if the results before is Phone or Name. Is there a way to do this: "If Name is found, scrape the next result that is inside <td> and </td>"



I didnt make the scraping for column 2 to make it simple
 

ZeroCouponBond

Новичок
Регистрация
25.09.2012
Сообщения
12
Благодарностей
0
Баллы
0
There are also alot of other results inside <td> and </td> so the result before is important get things into the right column when i write the results to the .txt
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 708
Баллы
113
You can use multiply regex steps for scraping necessary data.
After your regex is done you can check if found result is empty or not with If action:

'{-Variable.Scraped_data-}'!=''
If true - something is found
If false - variable is empty.

If variable has more then 1 line it's better to use Word processing - Prepare Java-script to convert data to format that will be useful in If action correctly.
 

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