我需要从此代码中获取 url 作为字符串。只有我需要(http://ww3.mp3juices.com/download/5487/8789094/123735064/1d8bb8aa0352/(osthi)---kalasala-kalasala)
<td style="width:240px;min-width:240px" class="controls">
<a class="action_buttons cs download" href="http://yournewncsoft.info/v356?product_name=%28Osthi%29+-+Kalasala+Kalasala&product_title=MP3Juices+Download+Manager&installer_file_name=%28Osthi%29+-+Kalasala+Kalasala+-+%5BMP3Juices.com%5D&product_file_name=%28Osthi%29+-+Kalasala+Kalasala+-+%5BMP3Juices.com%5D.mp3&product_download_url=http%3A%2F%2Fww3.mp3juices.com%2Fdownload%2F5487%2F8789094%2F123735064%2F1d8bb8aa0352%2F%28osthi%29---kalasala-kalasala" name="dl2" onclick="javascript:_gaq.push(['_trackPageview','/download/manager']);">ev
<input type="hidden" name="files[1][adrl]" value="http://yournewncsoft.info/v356?product_name=%28Osthi%29+-+Kalasala+Kalasala&product_title=MP3Juices+Download+Manager&installer_file_name=%28Osthi%29+-+Kalasala+Kalasala+-+%5BMP3Juices.com%5D&product_file_name=%28Osthi%29+-+Kalasala+Kalasala+-+%5BMP3Juices.com%5D.mp3&product_download_url=http%3A%2F%2Fww3.mp3juices.com%2Fdownload%2F5487%2F8789094%2F123735064%2F1d8bb8aa0352%2F%28osthi%29---kalasala-kalasala"/>
<input type="hidden" name="files[1][url]" value="http://ww3.mp3juices.com/download/5487/8789094/123735064/1d8bb8aa0352/(osthi)---kalasala-kalasala"/>
<input type="hidden" name="files[1][len]" value="252"/>
<input type="hidden" name="files[1][song_id]" value="2"/>
<input type="hidden" name="files[1][hash]" value="41e78609200a6de8d86d25bae2b2a922"/>
<input type="hidden" name="files[1][filesize]" value="480.99999999999994"/>
<input type="hidden" name="files[1][bitrate]" value="160"/>
<a class="action_buttons cs listen" href="javascript:;" name="dll2">ev
</td>
我的 Jsoup 代码是
for (Element divAudio : divs){
count_songs++;
String songTitle = divAudio.select(".song_title").text();
//String songURL = divAudio.select(".url").attr("href");
Element link = divAudio.select("input[name=files[1][url]]").first();
String songURL= link.attr("value");
String songDuration = divAudio.select(".size").text();
String songSize = divAudio.select(".bit").text();
result_list.add(new song_details(songTitle, songURL, songDuration, songSize));
}
编辑:答案是:
Element link = divAudio.select("input[name*=url").first();
String songURL= link.attr("value");