diff --git a/src/main/java/moviescraper/doctord/controller/siteparsingprofile/SiteParsingProfile.java b/src/main/java/moviescraper/doctord/controller/siteparsingprofile/SiteParsingProfile.java index f1e0c54b..faf74194 100644 --- a/src/main/java/moviescraper/doctord/controller/siteparsingprofile/SiteParsingProfile.java +++ b/src/main/java/moviescraper/doctord/controller/siteparsingprofile/SiteParsingProfile.java @@ -586,7 +586,8 @@ public static Document downloadDocumentFromURLString(String url) { public static Connection.Response getDocument(SearchResult searchResult) { try { - Thread.sleep(Duration.ofSeconds((int) (Math.random() * (10 - 5) + 5))); + if(searchResult.isJSONSearchResult()) + Thread.sleep(Duration.ofSeconds((int) (Math.random() * (10 - 5) + 5))); return Jsoup.connect(searchResult.getUrlPath()).userAgent(UserAgent.getRandomUserAgent()).ignoreHttpErrors(true).timeout(CONNECTION_TIMEOUT_VALUE).execute(); }catch (InterruptedException | IOException e){ System.err.println(e.getMessage()); @@ -596,7 +597,8 @@ public static Connection.Response getDocument(SearchResult searchResult) { public Connection.Response downloadDocument(SearchResult searchResult) { try { - Thread.sleep(Duration.ofSeconds((int) (Math.random() * (10 - 5) + 5))); + if(searchResult.isJSONSearchResult()) + Thread.sleep(Duration.ofSeconds((int) (Math.random() * (10 - 5) + 5))); return Jsoup.connect(searchResult.getUrlPath()).userAgent(UserAgent.getRandomUserAgent()).ignoreHttpErrors(true).timeout(CONNECTION_TIMEOUT_VALUE).execute(); }catch (InterruptedException | IOException e){ System.err.println(e.getMessage());