日期:2014-05-17  浏览次数:20775 次

怎么抓取网页中的数据
怎么抓取网页中的数据,比如这个html中的<li>节点下的值?
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<script language="javascript">

if (self!=top) window.top.location.replace(self.location);

</script>

<meta http-equiv="Content-Type" content="text/html; charset=gbk" />

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

<title>夫妻笑话-中文幽默王</title>

<meta name="keywords" content="夫妻笑话" />

<meta name="description" content="夫妻笑话-中文幽默王" />

<script type="text/javascript" src="http://cbjs.baidu.com/js/s.js"></script>

<base href="http://www.haha365.com/" />

<link href="favicon.ico" rel="shortcut icon" />

<link type="text/css" rel="stylesheet" href="templates/2008/skins/default/index.css"/>

<link type="text/css" rel="stylesheet" href="templates/2008/skins/default/example.css"/></head>

<body>

<div id="head">

<div class="head_content">

<div class="logo"><a href="http://www.haha365.com/"><img src="images/logo.gif" width="197" height="66" alt="中文幽默王,笑话" /></a></div>

<div class="user_login"><script type="text/javascript">BAIDU_CLB_singleFillSlot("122155");</script></div></div>

</div>

<div id="menu_bg">

<div class="menu">

<li><a href="/">首页</a></li><li><a href="/joke/">笑话大全</a></li>

<li><a href="/gxtp/">搞笑图片</a></li>

<li><a href="/bxww/">爆笑网文</a></li>

<li><a href="/hahags/">哈哈故事</a></li>

<li><a href="/humor/">综合趣味</a></li>

<li><a href="/zzkc/">智慧快餐</a></li>

<li><a href="/mrmy/">名人名言</a></li>

<li><a href="/hahaqw/">哈哈趣闻</a></li>

<li><a href="/skl/">段子</a></li>

<li><a href="http://www.haha365.net/" target="_blank">漫画</a></li>

<li style="width:2px;"></li>

</div>

</div><script type="text/javascript" src="templates/2008/skins/default/wb.js"></script>

<div id="main">

<div class="content">

<div id="position">当前位置:<a href="">首页</a><a href="/joke/">笑话大全</a><a href="/fqxh/">夫妻笑话</a></div>

<div class="blank15"></div>

<div class="left_box">

<div class="item_box">

<div class="bg_t"></div>

<div class="bg_c">

<h1>夫妻笑话</h1><hr align="center" width="85%" style="border:1px dashed;color:#D2D6D4;height:1px;margin-bottom:8px;">

<ul class="text_doublelist cat_llb"><div class=L16>

<A  href="/fqxh/">夫妻篇</A>  <A href="/Adult_joke/">成人篇</A>  <A  href="/laxh/">恋爱篇</A>  <br />

<A  href="/Family_joke/">家庭篇</A>  <A  href="/gd_joke/">古代篇</A>  <A  href="/dn_joke