有谁帮我解决这个问题啊。。。。就是关于用jsoup提取多个url 把这写url放在一个字段中、、、、

很好 发布于 2012/07/04 11:58
阅读 463
收藏 0
怎么把下面的代码给提取出来。。放在一个字段里面:

要求是把下面的每个p标签放在一个字段中。。下面有2个p标签就放在2个字段中。。。。。把url给提取出来。。。
<p class="provide provider clearfix" pos="provider">
  <em>推荐播放:</em>
  <a class="qiyi" key="1"
  title="在奇艺观看" href="http://www.iqiyi.com/dianying/20100413/n1545.html" target="_blank">
<span class="pro_logo">
</span>
<span>奇艺</span>
</a>
                  
<em class="pro_o">其他播放:</em>
       <a class="tudou" key="95"
                   title="在土豆观看" href="http://www.tudou.com/playlist/p/a51055.html"
                   target="_blank"><span class="pro_logo"></span><span>土豆</span></a>
                                          
       <a class="letv" key="113"
                   title="在乐视观看" href="http://www.letv.com/ptv/pplay/34698/1.html"
                   target="_blank"><span class="pro_logo"></span><span>乐视</span></a>
                                   
        <a class="youku" key="94"
                   title="在优酷观看" href="http://v.youku.com/v_show/id_XMTQxNjg1NzE2.html"
                   target="_blank"><span class="pro_logo"></span><span>优酷</span></a>
                                   
        <a class="m1905" key="151"
                   title="在m1905观看" href="http://www.m1905.com/vod/play/309923.shtml"
                   target="_blank"><span class="pro_logo"></span><span>m1905</span></a>
       </p>

<p class="provide provider clearfix" pos="provider">
        <em>推荐播放:</em>
                <a class="letv" key="113"
           title="在乐视观看" href="http://www.letv.com/ptv/pplay/74285/1.html" target="_blank"><span
                class="pro_logo"></span><span>乐视</span></a>
                    <em class="pro_o">其他播放:</em>
                                            <a class="youku" key="94"
                   title="在优酷观看" href="http://v.youku.com/v_show/id_XMzcyMDQ2ODUy.html"
                   target="_blank"><span class="pro_logo"></span><span>优酷</span></a>
                                            <a class="sohu" key="4"
                   title="在搜狐观看" href="http://tv.sohu.com/20120411/n340296063.shtml"
                   target="_blank"><span class="pro_logo"></span><span>搜狐</span></a>
                                            <a class="m1905" key="151"
                   title="在m1905观看" href="http://www.m1905.com/vod/play/518017.shtml"
                   target="_blank"><span class="pro_logo"></span><span>m1905</span></a>
                                            <a class="qq" key="133"
                   title="在腾讯观看" href="http://v.qq.com/cover/u/ughfdfxylkkhu08.html"
                   target="_blank"><span class="pro_logo"></span><span>腾讯</span></a>
                                            <a class="pptv" key="96"
                   title="在PPTV观看" href="http://v.pptv.com/show/j0XsatI4qOZJxws.html"
                   target="_blank"><span class="pro_logo"></span><span>PPTV</span></a>
                                            <a class="xunlei" key="150"
                   title="在迅雷观看" href="http://kankan.xunlei.com/vod/mp4/61/61526.shtml?id=731010"
                   target="_blank"><span class="pro_logo"></span><span>迅雷</span></a>
                                            <a class="tudou" key="95"
                   title="在土豆观看" href="http://www.tudou.com/playlist/p/a75276.html"
                   target="_blank"><span class="pro_logo"></span><span>土豆</span></a>
                        </p>
加载中
0
如风随影
如风随影
直接解析xml不就可以了嘛!
很好
很好
我是用jsoup和httpclient解析的好123网站。。。这是其中的一段代码。。。其他的都解析出来了就这个没有解析出来。。。我每次解析出来的都不在一个字段 我是想要他们一个标签一个字段 因为我要添加数据库。。。。。。
0
zys0
zys0

找到P的父节点 然后 循环 没循环一次不就是一个P   把 P 存起来, 然后 对P 进行操作  找到里面的 href  

// 找到 a标签  并且 class  是 SearchResultsSubLevelCategory  的  href

Elements links = doc.select("a[href].SearchResultsSubLevelCategory");

返回顶部
顶部