我在远程服务器上有一个文件列表页面,比如说http://myserver.com/uploads
. 如何使用 Ruby 获取文件列表,最好仅使用 net-http?
这是页面的 HTML 代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- saved from url=(0025)http://myserver.com/uploads/ -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Index of /uploads</title>
</head>
<body>
<h1>Index of /uploads</h1>
<table>
<tbody>
<tr>
<th><img src="./Index of uploads_files/blank.gif" alt="[ICO]"></th>
<th><a href="http://myserver.com/uploads/?C=N;O=D">Name</a></th>
<th><a href="http://myserver.com/uploads/?C=M;O=A">Last modified</a></th>
<th><a href="http://myserver.com/uploads/?C=S;O=A">Size</a></th>
<th><a href="http://myserver.com/uploads/?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th>
</tr>
<tr>
<td valign="top"><img src="./Index of uploads_files/back.gif" alt="[DIR]"></td>
<td><a href="http://myserver.com/">Parent Directory</a></td>
<td> </td>
<td align="right"> - </td>
<td> </td>
</tr>
<tr>
<td valign="top"><img src="./Index of uploads_files/compressed.gif" alt="[ ]"></td>
<td><a href="http://myserver.com/uploads/Backup_201305281256.tar.gz">Backup_201305281256.tar.gz</a></td>
<td align="right">28-May-2013 18:00 </td>
<td align="right"> 13M</td><td> </td>
</tr>
<tr><th colspan="5"><hr></th></tr>
</tbody>
</table>
<address>Apache/2.2.22 (Ubuntu) Server at myserver.com Port 80</address>
</body>
</html>