Java /使用代理打开网站并流式传输广播

时间:2017-08-27 13:17:41

标签: java proxy stream

我希望我打开收音机(http://sekundensparer.de/radio/start.php) 我不想听收音机。我只想下载流。 获得用户。

Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("104.131.118.88", 3128));
        HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(proxy);
          connection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0");
          BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));


             StringBuilder response = new StringBuilder();
             String inputLine;
             while ((inputLine = in.readLine()) != null) {
               response.append(inputLine);
             }


             System.out.println(response.toString());

0 个答案:

没有答案