音悦台800多万MV视频抓取

       闲的蛋疼,抓下音悦台的MV玩玩,昨晚研究到凌晨1点,现把代码分享与此,以作备忘,如果有涉及侵权,请音悦台通知我,我马上删除代码,哈哈!!!尴尬
       

//因为我发现音悦台的MV ID都是7位数字
		int max = 9999999;
		for(int i=0; i < max; i++) {
			String videoId = i + "";
		    String html = HttpClientUtils.getHTML("http://www.yinyuetai.com/insite/get-video-info?flex=true&videoId=" + videoId);
		    //System.out.println(html);
		    if(html == null || "".equals(html) || html.indexOf("找不到编号为") >= 0) {
		    	System.out.println("没有id={" + videoId + "}这个MV");
		    	continue;
		    }
		    
		  //音悦台VIP专享MV
		    Pattern pattern = Pattern.compile(".+(http://sh.yinyuetai.com/uploads/videos/common/[a-zA-Z0-9]+\\.mp4\\?(?!http).*?&vst=0Y).+");
		    Matcher matcher = pattern.matcher(html);
		    if(matcher.find()) {
		    	String url = matcher.group(1);
		    	System.out.println("id={" + videoId + "}VIP专享MV url:" + url);
		    } else {
		    	//超清MV
			    pattern = Pattern.compile(".+(http://he.yinyuetai.com/uploads/videos/common/[a-zA-Z0-9]+\\.flv\\?(?!http).*?&vst=0Y).+");
			    matcher = pattern.matcher(html);
			    if(matcher.find()) {
			    	String url = matcher.group(1);
			    	System.out.println("id={" + videoId + "}超清MV url:" + url);
			    } else {
			    	//高清MV
				    //.+(http://hd.yinyuetai.com/uploads/videos/common/[a-zA-Z0-9]+\\.flv\\?[^?]+&vst=0Y).+
				    pattern = Pattern.compile(".+(http://hd.yinyuetai.com/uploads/videos/common/[a-zA-Z0-9]+\\.flv\\?(?!http).*?&vst=0Y).+");
				    matcher = pattern.matcher(html);
				    if(matcher.find()) {
				    	String url = matcher.group(1);
				    	System.out.println("id={" + videoId + "}高清MV url:" + url);
				    } else {
				    	//流畅MV
					    //.+(http://hc.yinyuetai.com/uploads/videos/common/[a-zA-Z0-9]+\\.flv\\?[^?]+&vst=0Y).+
					    pattern = Pattern.compile(".+(http://hc.yinyuetai.com/uploads/videos/common/[a-zA-Z0-9]+\\.flv\\?(?!http).*?&vst=0Y).+");
					    matcher = pattern.matcher(html);
					    if(matcher.find()) {
					    	String url = matcher.group(1);
					    	System.out.println("id={" + videoId + "}流畅MV url:" + url);
					    } else {
					    	continue;
					    }
				    }
			    }
		    }
		    
		}

   得到了MV视频的URL后,你可以先把URL全部写到一个txt文件里,然后就写个程序一行一行的读取URL去下载flv文件即可啦,这个大家我想都会吧,就跟下载jpg图片类似的,我就不多啰嗦了!!!效果图如下:

 
    

    

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值