【发布时间】:2017-01-24 13:47:53
【问题描述】:
我正在尝试从 div.class yt-lockup-content 获取 href 属性,但它返回 null 我做错了什么?
<div class="yt-lockup-content">
<h3 class="yt-lockup-title "><a class="yt-uix-sessionlink yt-uix-tile-link spf-link yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr" title="Live :: PTV Sports Official Live Transmission" data-sessionlink="ei=K8uGWMHkGMWjcp7dhNAJ&feature=c4-live-promo" href="/watch?v=8M00cos0d_0">Live :: PTV Sports Official Live Transmission</a></h3>
到目前为止我尝试过的这段代码:
rssDocument = Jsoup.connect("https://www.youtube.com/channel/UC0KT03NPnN-j4HGzetW9Lpw/featured").timeout(6000).ignoreContentType(true).parser(Parser.htmlParser()).get();
Elements firstH1 = rssDocument.select("div.yt-lockup-content > h3 > a");
我需要这个网址:href="/watch?v=8M00cos0d_0"
【问题讨论】: