I have some HTML code and want to convert for JSoup, but my code did not work.
我有一些HTML代码,并希望转换为JSoup,但我的代码不起作用。
My code is:
我的代码是:
<div id="right_song">
<div class="mp3_title"><b>Title</b></div>
<div class="empty"></div>
<div class="empty"></div>
</div>
<div class='songInfoMobile' style='font-size:11px; margin-top:5px;'>
3.71 mb
</div>
<div class="mp3_bottom_box">
<div class="button_box">
<div class="download_button">
<a href="http://www.mytest.com/test.html" rel="nofollow" target="_blank">Download</a>
</div>
</div>
</div>
My JSoup code is :
我的JSoup代码是:
link = rightSong.child(2).select("a[href]").first().attr("href");
I want to add from div id="right_song"
to http://www.mytest.com/test.html
in my JSoup code. What's wrong?
我想在我的JSoup代码中将div id =“right_song”添加到http://www.mytest.com/test.html。怎么了?
1 个解决方案
#1
0
Solution found by OP:
OP发现的解决方案:
Hello Nasha, I have solved my problem. The solution is link = rightSong.siblingElements().select("a[href]").first().attr("href"); Thanks to all friends
您好Nasha,我已经解决了我的问题。解决方案是link = rightSong.siblingElements()。select(“a [href]”)。first()。attr(“href”);感谢所有朋友
#1
0
Solution found by OP:
OP发现的解决方案:
Hello Nasha, I have solved my problem. The solution is link = rightSong.siblingElements().select("a[href]").first().attr("href"); Thanks to all friends
您好Nasha,我已经解决了我的问题。解决方案是link = rightSong.siblingElements()。select(“a [href]”)。first()。attr(“href”);感谢所有朋友