宾阳之窗 发表于 2009-5-9 10:39:18

这个网页采集是怎么回事呀?

<HTML><HEAD><title>农村夫妻搞养殖年挣百万</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312"/>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link rel="stylesheet" href="../../style/gxny/style.css" type="text/css"/>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="/images/main.css" type=text/css rel=stylesheet>
<meta name="generator" content="iwms网站管理系统"/>
<script type="text/javascript" src="../../inc/show.js"></script>
<META content="MSHTML 6.00.3790.4324" name=GENERATOR><style type="text/css">
<!--
body {
background-color: #d5e7f4;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE2 {color: #003300}
.STYLE3 {color: #CC3300}
.STYLE4 {
color: #CC6600;
font-weight: bold;
}
-->
</style></HEAD>
<BODY><div align="center"><table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" background="/imgser/index_00.jpg" bgcolor="EBE9E9">
<tr>
    <td width="257" height="20">&nbsp;</td>
    <td width="215">&nbsp;</td>
    <td width="334">&nbsp;</td>
    <td width="176"><img src="/images/big5.gif" width="19" height="12" align="absmiddle"> <a href="http://big5.gxny.gov.cn" target="_blank"><font color="#FFFFFF">繁体中文</font></a>&nbsp;&nbsp; <img src="/images/eng.gif" width="19" height="12" align="absmiddle"> <a href="http://eng.gxny.gov.cn" target="_blank"><font color="#FFFFFF">ENGLISH</font></a></td>
</tr>
</table>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
    <td colspan="2"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="124">
      <param name="movie" value="/images/top_ser.swf">
      <param name="quality" value="high">
   <param name=wmode value=Opaque>
      <embed src="/images/top_ser.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="124"></embed>
    </object></td>
</tr>
<tr>
    <td width="900" height=25 background="/imgser/titbg01.gif" class="p9-white">&nbsp; <a href="../../web/c90/index.htm" target="_top"><font color="#FFFFFF">服务版首页</font></a> | <a href="/supply/" target="_top"><font color="#FFFFFF">最新供求</font></a> | <a href="/supply/more.asp?type=1" target="_top"><font color="#FFFFFF">供应信息</font></a> | <a href="/supply/more.asp?type=2" target="_top"><font color="#FFFFFF">求购信息</font></a> | <a href="/supply/add.asp" target="_top"><font color="#FFFFFF">发布供求</font></a> | <a href="http://gongqiu.agri.org.cn/gx/" target="_blank"><font color="#FFFFFF">农业部供求信息联播</font></a> | <a href="../../web/c9/index.htm" target="_top"><font color="#FFFFFF">招商引资</font></a> | <a href="../../web/c10/index.htm" target="_top"><font color="#FFFFFF">企业园地</font></a> | <a href="../../web/c56/index.htm" target="_top"><font color="#FFFFFF">种植技术</font></a> |&nbsp;<a href="../../web/c57/index.htm" target="_top"><font color="#FFFFFF">养殖技术</font></a> | <a href="../../web/c58/index.htm" target="_top"><font color="#FFFFFF">加工技术</font></a> | <a href="../../web/c59/index.htm" target="_top"><font color="#FFFFFF">综合技术</font></a> </td>
    <td width="100" background="/imgser/titbg01.gif" class="p9-white"><a href="/" target="_blank"><img src="/images/menu.gif" width="100" height="25" border="0" /></a></td>
</tr>
<tr>
    <td height="25" background="/imgser/titbg02.gif" class="p9-white">&nbsp; <a href="../../web/c60/index.htm" target="_top"><font color="#FFFFFF">农资产品</font></a> | <a href="../../web/c61/index.htm" target="_top"><font color="#FFFFFF">农机产品</font></a>&nbsp; | <a href="../../web/c62/index.htm" target="_top"><font color="#FFFFFF">其它产品</font></a>&nbsp; | <a href="../../web/c15/index.htm" target="_top"><font color="#FFFFFF">良种园</font></a> | <a href="../../web/c63/index.htm" target="_top"><font color="#FFFFFF">国内市场</font></a> | <a href="../../web/c64/index.htm" target="_top"><font color="#FFFFFF">国际市场</font></a> | <a href="/price_system_product.aspx?cid=90" target="_top"><font color="#FFFFFF">农产品价格</font></a> | <a href="../../web/c16/index.htm" target="_top"><font color="#FFFFFF">名优特色产品</font></a> | <a href="../../web/c19/index.htm" target="_top"><font color="#FFFFFF">乡村大世界</font></a> | <a href="../../web/c27/index.htm" target="_top"><font color="#FFFFFF">乡镇村信息</font></a> | <a href="../../web/c20/index.htm" target="_top"><font color="#FFFFFF">致富之窗</font></a> | <a href="../../web/c21/index.htm" target="_top"><font color="#FFFFFF">生活小园地</font></a></td>
    <td height="25" background="/imgser/titbg02.gif" class="p9-white"><a href="http://www.gxape.com.cn" target="_blank"><img src="/images/menu2.gif" width="100" height="25" border="0" /></a></td>
</tr>
</table>
</div>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >
<tr>
    <td valign="top"><table width="100%" border="0" cellspacing="5" cellpadding="0">
      <tr>
      <td height="28" bgcolor="D6ECFD" class="p9">&nbsp; <img src="/images/c003.gif" width="16" height="16" align="absmiddle"> <a href="../../index.htm">首页</a> → <a href="../../web/c90/index.htm">服务版</a> → <a href="../../web/c20/index.htm">致富之窗</a></td>
      </tr>
    </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td height="50" align="center" class="p18-hei">农村夫妻搞养殖年挣百万<br>
          </td>
      </tr>
      <tr>
          <td align="center" class="p9"><font color=999999>[日期:2008-11-25]&nbsp;&nbsp;来源:三农致富网&nbsp;&nbsp; 作者:转载&nbsp;&nbsp; 阅读:<span id="news_hits"></span> 次</font></td>
      </tr>
      <tr>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td bgcolor="#CCCCCC" height=1></td>
      </tr>
      <tr>
          <td height="20">&nbsp;</td>
      </tr>
      <tr>
          <td class="p11"><div id="content"><P><BR>  如今,在河南省商水县舒庄乡有一对非常有名气的夫妻,他们依靠科技养牛养猪,年收入近百万元,被当地广大干部群众誉为“科技夫妻”。这对“科技夫妻”丈夫名叫张保军,妻子叫张凤英。 </P>
<P>  1998年春季,张凤英从报上了解到国内生猪市场价格攀升的信息后,萌发了建养猪场的念头。随后她投资15万元,在村外建起一个占地2.5亩的养猪场,当年饲养母猪12头。去年她出栏生猪300头,收入27万元,今年收入将达到32万元。 </P>
<P>  妻子养猪成为致富标兵,张保军也不甘落后。2002年,张保军投资100万元建起一个占地5.6亩的黄牛育肥场,实行自繁自养、买小喂大、买瘦育肥的方法,当年饲养黄牛100头,年底出栏80头,收入20多万元。去年,张保军除出栏120头黄牛外,还把80头黄牛肉加工成五香牛肉销售,收入达58万元,预计今年收入还要增加。 </P></div>


</td>
      </tr>
      <tr>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td align="right"><a href="javascript:doPrint()"><img src="/images/icon_05_01.jpg" width="86" height="22" border="0"></a>&nbsp;<a href="javascript:window.close();"><img src="/images/icon_05_02.jpg" width="86" height="22" border="0"></a> </td>
      </tr>
      <tr>
          <td>上一篇:<a href="../../web/2008-11/228701.htm">增收致富养殖“果园鸡”</a><br/>
   下一篇:<a href="../../web/2008-11/228710.htm">青青河边草长成摇钱树</a></td>
      </tr>
      <tr>
          <td align="right">&nbsp;</td>
      </tr>
      </table></td>
</tr>
</table><iframe src="../../frm_hit.aspx?id=228705&disp=1" style="visibility:hidden;width:0;height:0"></iframe>
<style type="text/css">BODY {
BACKGROUND-POSITION: center 50%; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(bg.gif); MARGIN: 0px; COLOR: #333333;
}
TABLE {
FONT-SIZE: 12px; COLOR: #333333
}
TD {
FONT-SIZE: 12px; COLOR: #333333
}
A:link {
COLOR: #333333; TEXT-DECORATION: none
}
A:visited {
COLOR: #333333; TEXT-DECORATION: none
}
A:active {
COLOR: #333333; TEXT-DECORATION: none
}
A:hover {
COLOR: #ff6600; TEXT-DECORATION: underline
}</style>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
    <td height=5></td>
</tr>
</table>
<TABLE width=1000 height=100 border=0 align=center cellPadding=0 cellSpacing=0 background="/images/fbg2.gif" bgColor=#fdfdfd
class=line>
<TBODY>
    <TR>
      <TD height=19 class=p9>&nbsp;</TD>
    </TR>
    <TR>
      <TD height=19 class=p9><DIV align=center>
      注:本网为政府公益性网站,转载文章是为“三农”提供免费信息咨询。如所转载文章的作者或单位不同意转载,请与我中心联系。 </DIV></TD>
    </TR>
    <TR>
      <TD height=19 class="p9"><DIV align=center><SPAN class=font13><FONT color="#ff3300" class=font13>主办:广西壮族自治区农业厅 承办:</FONT></SPAN><font color="#ff3300">广西壮族自治区农业信息中心</font><BR>
            版权所有 &copy; <FONT color=#000000>广西农业信息中心</FONT> <a href="http://www.miibeian.gov.cn" target="_blank">桂ICP备05008868</a><BR>
      地址:广西壮族自治区南宁市七星路135号(530022)<BR>
            <img src="/images/tel.jpg" width="451" height="19"><br>
            2003年6月起总访问量为
            <script language="JavaScript" src="/counter/count.asp" type="text/JavaScript"></script>
            人次   <IMG src="/images/police.gif" width=25
      height=34 border=0 align="absmiddle"> <a href="http://222.216.1.138/netalarm/Welcome.jsp?bano=4501200184" target="_blank">南宁网警单位备案4501200184号</a></DIV>
      <DIV align=center></DIV></TD>
    </TR>
</TBODY>
</TABLE>

</BODY></HTML>




以上这个网页的采集规则怎么做呀?怎么我做出来的都不对呢?
比如
标题:<HTML><HEAD><title>                </title>
内容:<td class="p11"><div id="content"><P><BR>               </div>
来源:来源:
作者:作者:
结果一测试,根本就没有内容,只采到了标题,这到底是错在哪里呀。我已经把里面的代码快换完了,还是不能采到内容。谁能说说看,我是错在哪里呢?

hardon 发表于 2009-5-9 11:11:49

标题:<title>               </title>
内容:<div id="content">               </div>
来源:广西农业信息中心
作者:宾阳之窗
這樣應該可以采到! 用正規在做可以有更好的效果!

宾阳之窗 发表于 2009-5-9 11:40:18

还是不行哦。就是不能采到内容,只有标题

hardon 发表于 2009-5-9 12:42:36

試試這個!

宾阳之窗 发表于 2009-5-9 13:11:38

多谢楼上的,终于可以了。不过,我还是不明白问题出在哪里。如果你能说出来更好了。

hardon 发表于 2009-5-11 11:55:01

詳細也不知道您的問題出在哪,如果您想知道,您要把您的規則讓我看看!!!
因為我用的只是之前文字教您的一樣.
标题:<title>               </title>
内容:<div id="content">               </div>
来源:广西农业信息中心
作者:宾阳之窗

宾阳之窗 发表于 2009-5-12 00:23:08

由于我的规则不能用,所以,我直接删除了。我忘了先发上来让大家一起看看看了。只有等下次碰到这样的问题才行了。多谢了。

宾阳之窗 发表于 2009-5-12 00:24:38

其实,开始我的也和你的一样,就是没有设成你后两个的固定字段而已 。难道是出在这里吗?不应该呀。那个内容的字段我的和你的完全是一样的。怎么就采集不对呢?怪了。

hardon 发表于 2009-5-12 12:39:16

标题:<HTML><HEAD><title>                </title>
内容:<td class="p11"><div id="content"><P><BR>               </div>

標題規則 : <HTML><HEAD>
雖然該網站的變數大多,但這兩個tag在forum的時候都有機會改變參數,例如<html>可能會因為w3的規則需要而自行加上參數 <html xmlns="http://www.w3.org/1999/xhtml">.
但由於該網站沒有變化,所以您可以采到標題.

而內容里的規則 <td class="p11"><div id="content"><P><BR>
這里的td tag有 class參數在里邊, 這是一個變數,你看到的是class="p11",可能下一頁會變成class="e12"或者其他的class名稱,如果您真是想要以td開始作采集位置,那規則就要變成以下的方式才有效.
内容:<td class="(*)"><div id="content"><P><BR>               </div>
页: [1]
查看完整版本: 这个网页采集是怎么回事呀?