下载 Line 图片但权限被拒绝

download Line pictures but get permission denied

我正在尝试使用 Java 下载这些漫画图片。我已经从 HTML 代码中获取了这些图片的 Url,但是当我连接到它时,服务器告诉我我没有访问其中图片的权限。 我试图找出是否有一些 post 或请求请求许可,但找不到它。有人可以帮助我了解获得访问权限的想法吗? 非常感谢 ^ ^ !

Link 页面:http://www.webtoons.com/zh-hant/drama/yushentongxing/%E7%AC%AC1%E8%A9%B1-%E7%A5%9E%E7%9A%84%E5%AF%A9%E5%88%A4-01/viewer?title_no=734&episode_no=1

图片的

和link:http://webtoon.phinf.naver.net/20160901_41/1472713930299oYcIe_JPEG/147271393026973416.jpg?type=q90

拒绝邮件:

推荐被拒绝 您无权访问“http://webtoon.phinf.naver.net/20160901_41/1472713930299oYcIe_JPEG/147271393026973416.jpg?”在这台服务器上。 参考#24.5e41ca3.1516454916.3d5b39b

这是我下载图片的代码:

URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
BufferedImage image = ImageIO.read(url);
ImageIO.write(image, "jpg", new File(output));

服务器简单地检查 Referer HTTP Header 以匹配“http://www.webtoons.com/”(从页面加载图像时由浏览器自动添加)

所以通过 API 添加这个 header 应该就足够了,下面的代码为我打印了 200 个成功代码:

        URL url = new URL("http://webtoon.phinf.naver.net/20160901_41/1472713930299oYcIe_JPEG/147271393026973416.jpg?type=q90");
        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
        connection.setRequestProperty("Referer", "http://www.webtoons.com/");
        int responseCode = connection.getResponseCode();
        System.out.println(responseCode);