java - jsoup unexpectedly fetching shopwiki image -
i using following code fetch images web:
import java.io.fileoutputstream; import java.io.ioexception; import org.jsoup.jsoup; public class fetchimagetest { public static void main(string[] args) throws exception { saveimage(args[0], args[1]); } private static boolean saveimage(string string, string destination) throws ioexception { string = string.replaceall(" ", "%20"); try { byte[] image = jsoup.connect(string).ignorecontenttype(true).timeout(10000).execute().bodyasbytes(); fileoutputstream os = new fileoutputstream(destination); os.write(image); os.close(); return true; } catch (ioexception e) { system.out.println("couldn't open " + string); return false; } catch (exception e) { system.out.println("couldn't open - general exception" + string); return false; } } }
due bug in of other code, tried fetch image broken url, of form:
http://shop.foo.comhttp://shop.foo.com/1.jpg
my code ended fetching shopwiki image,
i using jsoup-1.7.1.jar. there virus on server? there virus jsoup jar file?
i have no idea ...
several sites set system protect recovery of image.
i guess try retrieve images shopwiki.com watched url retrieve picture is established security.
Comments
Post a Comment