鱼C论坛

 找回密码
 立即注册
查看: 881|回复: 5

还是懒人读书的,今天解析到了value为空的情况,不知道怎么继续下去了

[复制链接]
发表于 2019-3-13 08:21:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 wp231957 于 2019-3-13 08:34 编辑
  1. <div class="column1 nowrap">
  2.                         <div class="column1-l">
  3.                                 <span class="section-number">1</span>
  4.                                 <i class="playing"></i>
  5.                         </div>
  6.                         <span>&#x7b2c;01&#x96c6;_&#x75af;&#x72c2;&#x7684;&#x533b;&#x9662;</span>
  7.                        <input type="hidden" value="http://kting.info/asdb/fiction/kongbu/fkdyy/xiq6loqk.mp3" name="source" />
  8.                           <input type="hidden" value="&#x4e5d;&#x65b9;&#x697c;&#x5170;" name="player-r-original" data-href="/search/book/&#x4e5d;&#x65b9;&#x697c;&#x5170;" />
  9.                           <input type="hidden" value="&#x65e0;&#x540d;&#x6c0f;&#xff0c;&#x5b59;&#x8d8a;" name="player-r-studio" data-href="/user/79939513"/>

  10.                         <input type="hidden" value="711781949" name="sectionid"/>
  11.                         <input type="hidden" value="&#x7b2c;01&#x96c6;_&#x75af;&#x72c2;&#x7684;&#x533b;&#x9662;" name="player-r-name"/>
  12.                         <input type="hidden" value="1" name="number"/>
  13.                         <input type="hidden" value="3840" name="share-fatherEntityId"/>
  14.                         <input type="hidden" value="4" name="share-entityType"/>
  15.                 </div>
复制代码



#这里却是能取到真实的路径  见上面第七行

#而换本书 ,这个value就是空的,(见下面第七行) 遇到这种情况 应该怎么继续下去呢

  1. <div class="column1 nowrap">
  2.                         <div class="column1-l">
  3.                                 <span class="section-number">8</span>
  4.                                 <i class="playing"></i>
  5.                         </div>
  6.                         <span>&#x7b2c;008&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</span>
  7.                        <input type="hidden" value="" name="source" />
  8.                           <input type="hidden" value="&#x5e18;&#x971c;" name="player-r-original" data-href="/search/book/&#x5e18;&#x971c;" />
  9.                           <input type="hidden" value="&#x5c0f;&#x4e11;&#x9c7c;" name="player-r-studio" data-href="/user/67418424"/>

  10.                         <input type="hidden" value="361791159" name="sectionid"/>
  11.                         <input type="hidden" value="&#x7b2c;008&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;" name="player-r-name"/>
  12.                         <input type="hidden" value="8" name="number"/>
  13.                         <input type="hidden" value="32931" name="share-fatherEntityId"/>
  14.                         <input type="hidden" value="4" name="share-entityType"/>
  15.                 </div>
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2019-3-13 10:05:12 | 显示全部楼层
可能value是用js生成的,你用splash渲染出来再看看能不能提取到
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-3-13 10:10:59 | 显示全部楼层
wiselin 发表于 2019-3-13 10:05
可能value是用js生成的,你用splash渲染出来再看看能不能提取到

手新,能细说一下吗
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-3-13 10:23:07 | 显示全部楼层
把网址发出来行吗??
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-3-13 10:38:23 | 显示全部楼层
  1. # coding: utf-8
  2. import requests as req
  3. from lxml import etree
  4. import os

  5. bookname="嫡女有毒"
  6. url = 'http://www.lrts.me/search/book/%s'%bookname
  7. response = req.get(url)  
  8. html = etree.HTML(response.text)
  9. bookid = html.xpath('//a[@class="book-item-name"]')[0].xpath('@href')[0].split('/')[-1]
  10. print(bookid)
  11. url2 = 'http://www.lrts.me/ajax/playlist/2/%s/1'%bookid
  12. response2 = req.get(url2)
  13. html2 = etree.HTML(response2.text)
  14. page = int(html2.xpath('//div[@class="detail"]/div/span')[1].xpath('text()')[0])
  15. print(page)
  16. infos = []
  17. #for p in range(page//10+1):
  18. url3 = 'http://www.lrts.me/ajax/playlist/2/%s/%d'%(bookid, 1)
  19. response3 = req.get(url3)
  20. html3 = etree.HTML(response3.text)
  21. print(response3.text)
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-3-13 21:24:43 | 显示全部楼层
  1. <section class="d-section">
  2.                                 <div class="d-tab">
  3.                                         <span>书籍章节</span>
  4.                                 </div>
  5.                                 <ul id="pul">
  6.                                         <li><time>更新时间:2017-03-24</time><span>1</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=1"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=1">&#x7b2c;001&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  7.                                         <li><time>更新时间:2017-11-29</time><span>2</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=2"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=2">&#x7b2c;002&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  8.                                         <li><time>更新时间:2017-03-24</time><span>3</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=3"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=3">&#x7b2c;003&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  9.                                         <li><time>更新时间:2017-03-24</time><span>4</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=4"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=4">&#x7b2c;004&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  10.                                         <li><time>更新时间:2017-03-24</time><span>5</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=5"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=5">&#x7b2c;005&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  11.                                         <li><time>更新时间:2017-03-24</time><span>6</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=6"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=6">&#x7b2c;006&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  12.                                         <li><time>更新时间:2017-03-24</time><span>7</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=7"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=7">&#x7b2c;007&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  13.                                         <li><time>更新时间:2017-03-24</time><span>8</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=8"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=8">&#x7b2c;008&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  14.                                         <li><time>更新时间:2017-03-24</time><span>9</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=9"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=9">&#x7b2c;009&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  15.                                         <li><time>更新时间:2017-03-24</time><span>10</span><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=10"><i class="icon-play-d"></i></a><a class="player-trigger " player-info="type=2&resourcesid=32931&sections=10">&#x7b2c;010&#x96c6;_&#x5ae1;&#x5973;&#x6709;&#x6bd2;</a></li>
  16.                                 </ul>
  17.                                 <div class="pager"><div class="pagination" id="pager"></div></div>
  18.                         </section>
复制代码

无法发图片,这些个代码 是一个播放页面的一部分,总共是10集,每一集的前面有个播放按钮,点击则进入播放界面(另一个窗口),现在就是想爬到这个窗口
初步想法是使用selenium来做,但是不知道使用find_element_by_??? 来模拟点击,也不知道这些class 啥的 都哪个是代表那个播放按钮的
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-1-14 14:07

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表