Java.io.IOException: invalid Http response

Now, before you say that there are such questions, I would like to indicate that I looked through most of them with no luck. I am also the first timer, so be careful.

I have this annoyance right now in my current program:

Basically this part of my program uses a search engine to search torrent files.

public static ArrayList<String> search(String args) throws IOException {        
    args = args.replace(":", "");

    ArrayList<String> list = new ArrayList<String>();
    URL url = new URL("http://pirateproxy.net/search/" + args + "/");
    URLConnection con = url.openConnection();
    BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); <---- THIS
}

public static void main(String[] args) {
    try {
        search("The Hobbit: The Desolation of Smaug");
    } catch (IOException e) {
        e.printStackTrace();
    }
}

ERROR:

java.io.IOException: Invalid Http response
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at service.ServiceDownloader.search(ServiceDownloader.java:20)
at service.ServiceDownloader.main(ServiceDownloader.java:45)

Now the fun part is that it ONLY goes wrong for this film ("The Hobbit: Smaug Despair"), every other film works just fine. I do not understand this. Please, help. (I also removed every unnecessary code from the search method)

If I have not provided enough information, please ask me more.

+4
2

URL- String The Hobbit: The Desolation of Smaug, . : .

+4

, (:) . ?

+1

Source: https://habr.com/ru/post/1529947/


All Articles