//http://www.ityks.com 专业Java培训
//使用OKHTTP与JSOUP
@Test
void testKuwo() {
HttpDemo http = new HttpDemo();
String baseUrl = "http://www.kuwo.cn/bang/content?name=%E9%85%B7%E6%88%91%E7%83%AD%E6%AD%8C%E6%A6%9C&bangId=16";
String indexPage = http.doGetString(baseUrl);
Document doc = Jsoup.parse(indexPage);
Elements nameEles = doc.getElementsByClass("name");
Iterator<Element> nameIter = nameEles.iterator();
String url = "http://antiserver.kuwo.cn/anti.s?format=aac|mp3&rid=MUSIC_%s&type=convert_url&response=res";
while (nameIter.hasNext()) {
try {
Element nameEle = nameIter.next();
Elements aTagEles = nameEle.getElementsByTag("a");
Element aTagEle = null;
if (aTagEles.size()==1) {
aTagEle = nameEle.child(0);;
}else {
continue;
}
Java爬虫酷我音乐
最新推荐文章于 2021-09-03 15:09:26 发布