我试图从 div.class yt-lockup-content 获取Range("A1").Copy
属性,但它正在返回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");
答案 0 :(得分:2)
选项可以是在select:
之后读取属性Document doc = Jsoup.parse(html);
Elements link = doc.select("div.yt-lockup-content > h3 > a");
String hrefAttribute = link.attr("href");
System.out.println(hrefAttribute);
输出:
/观看?V = 8M00cos0d_0