我解析HTML包含内嵌CSS的图像在一个表中,我可以用引入nokogiri确定URL分量,这里是我想要解析的代码片段:
tldr:i'ld喜欢用引入nokogiri进入这个HTML片段的巴纽
<table border="0" cellspacing="0" cellpadding="0" width="300" height="300" background="http://s3.amazonaws.com/static.example.com/sale/homepage/3166-300x300-1328107072.png" style="background-image:url('http://s3.amazonaws.com/static.example.com/sale/homepage/3166-300x300-1328107072.png');background-repeat:no-repeat;background-color:#cacaca">
<tbody><tr>
<td>
<table background="http://s3.amazonaws.com/static.example.com/relaunch/transparent-strip1_1x1.png" style="background-image:url('http://s3.amazonaws.com/static.example.com/relaunch/transparent-strip1_1x1.png');background-repeat:repeat;background-color:transparent" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td style="vertical-align:middle" width="260" height="60">
<span style="font-family:Arial,Helvetica,sans-serif;font-size:13px;padding:2px 5px 0 10px;font-weight:bold;display:block;color:#ffffff">Kristins Gifts</span>
<span style="font-family:Arial,Helvetica,sans-serif;font-size:12px;padding:2px 5px 0 10px;line-height:16px;display:block;color:#ffffff">Stationery to Explore</span>
</td>
</tr>
</tbody></table>
</td>
<td>
<table background="http://s3.amazonaws.com/static.example.com/relaunch/transparent-strip1_1x1.png" style="background-image:url('http://s3.amazonaws.com/static.example.com/relaunch/transparent-strip1_1x1.png');background-repeat:repeat;background-color:transparent" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td style="vertical-align:top;text-align:right" width="50" height="60">
<span style="display:block;padding:18px 16px 0 0"><a href="http://mailer.example.com/clzh.7n1p/Ty4bBi0W_QUigx74Be7d5" alt="Stationery to Explore" title="Stationery to Explore" style="display:inline-block;outline:none" target="_blank"><img src="http://s3.amazonaws.com/static.example.com/relaunch/sales-arrow-button.png" alt=" > " height="23" width="23" style="border:0"></a></span>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td colspan="2" height="240">
<a href="http://mailer.example.com/clzh.7n1p/Ty4bBi0W_QUigx74C5096" alt="Stationery to Explore" title="Stationery to Explore" style="width:100%;min-height:240px;display:block;outline:none" target="_blank"></a>
</td>
</tr>
</tbody></table>