K
K
KuniLinux2015-04-27 02:03:31
ruby
KuniLinux, 2015-04-27 02:03:31

Ruby HTML parser?

I spent a lot of time reading books on the Ruby language, but when I got to practice, I got stuck -
Task:
Parse an html page (which has a table)

<tr align=center class=odd>
    <td class=grayed>$номер строки</td>
    <td><a href="$ссылка на конкретную страницу с адресом в виде  /path/to/$id_1>id_1</a></td>
    <td>$дата на 5 дней раньше текущей</td>
    <td align=center id=expired><nobr>$дата на 5 дней раньше с добавлением (-5)</nobr></td>
    <td align=left>$заметка</td>
    
    <td align=center><a href=path/to/1111/>$имя юзера(нужно спарсить, так же id(1111)</a> </td>

at the output, get an array containing the name, id, note,
the landmark goes exactly to those who have a postscript (-5)
lines that contain (-4) (-2) (-1) (3), etc. do not touch

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2015-04-27
@KuniLinux

If the question is how and what, then nokogiri.

T
timoo, 2015-04-27
@tomcat1911

split & gsub are easy to handle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question