diff --git a/src/getUrlResults.java b/src/getUrlResults.java index 40332ac..2b01098 100644 --- a/src/getUrlResults.java +++ b/src/getUrlResults.java @@ -4,6 +4,7 @@ import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; @@ -18,8 +19,10 @@ for (String line : linesList) { if (line.contains(lookForText)) { - System.out.println(line.substring(lookForText.length() + 2, lookForText.length() + 2 + searchText.length())); - resultList.add(line.substring(lookForText.length() + 2, lookForText.length() + 2 + searchText.length())); + String word = line.substring(lookForText.length() + 2, lookForText.length() + 2 + searchText.length()); + if (word.equals("%c3%")) continue; + System.out.println(word); + resultList.add(word); } } @@ -45,6 +48,8 @@ } catch (MalformedURLException mue) { mue.printStackTrace(); + } catch (UnknownHostException uhe) { + System.err.println("Error: No internet connection."); } catch (IOException ioe) { ioe.printStackTrace(); } finally {