Java 下载网易云版权限制的歌

 下载网易云可以试听,但是版权受限不让下载的歌。不是能要会员的,必须是可以听的,因为会员不能在网页上加载媒体资源。F12后发现.m4a的文件是音乐文件,可以在本地打开,直接抓下来。

Java 下载网易云版权限制的歌_第1张图片

 

package com.wmy.DownLoad;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class UrlDownLoad {
    public static void main(String[] args) throws Exception{
        URL url = new URL("https://m10.music.126.net/20200318175643/73d912e9321034610bf09ced41bd87aa/yyaac/obj/wonDkMOGw6XDiTHCmMOi/1689472861/ca8e/0675/dc1f/3c9427d089d138be8d5b139846a4ea96.m4a");
        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
        InputStream inputStream = urlConnection.getInputStream();
        FileOutputStream fos = new FileOutputStream("light the light.m4a");

        byte[] buffer = new byte[1024];
        int len;
        while ((len=inputStream.read(buffer))!=-1)
            fos.write(buffer, 0, len);

        fos.close();
        inputStream.close();
        urlConnection.disconnect();
    }
}

 

 

你可能感兴趣的:(Java 下载网易云版权限制的歌)