diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomParsingProfileTest.java index 3ee6a6c1..501d486b 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomParsingProfileTest.java @@ -36,7 +36,10 @@ public static void initialize() { String searchString = parser.createSearchString(file); try { SearchResult[] searchResults = parser.getSearchResults(searchString); - Document document = SiteParsingProfile.getDocument(searchResults[0]); + var response = SiteParsingProfile.getDocument(searchResults[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + Document document = response.parse(); parser.setDocument(document); } catch (IOException e) { e.printStackTrace(); diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomPremiumParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomPremiumParsingProfileTest.java index 5dbd3562..5517eef3 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomPremiumParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/CaribbeancomPremiumParsingProfileTest.java @@ -36,7 +36,11 @@ public static void initialize() { String searchString = parser.createSearchString(file); try { SearchResult[] searchResults = parser.getSearchResults("122716_008"); - Document document = SiteParsingProfile.getDocument(searchResults[0]); + + var response = SiteParsingProfile.getDocument(searchResults[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + Document document = response.parse(); System.out.println("Scrape: " + document.location()); parser.setDocument(document); parser.prepareData(); diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/JavBusParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/JavBusParsingProfileTest.java index fbbe8c9b..f41093ca 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/JavBusParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/JavBusParsingProfileTest.java @@ -41,10 +41,14 @@ public static void initialize() { String searchString = profile.createSearchString(file); System.out.println("searchString = " + searchString); try { - SearchResult[] searchResults = profile.getSearchResults(searchString); - Document document = SiteParsingProfile.getDocument(searchResults[0]); - System.out.println("document set to " + document.baseUri()); - profile.setDocument(document); + var response = SiteParsingProfile.getDocument(profile.getSearchResults(searchString)[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + + Document doc = response.parse(); + profile.setDocument(doc); + System.out.println("document set to " + doc.baseUri()); + profile.prepareData(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MissAVParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MissAVParsingProfileTest.java index 43755a91..d2318ab4 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MissAVParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MissAVParsingProfileTest.java @@ -1,5 +1,6 @@ package moviescraper.doctord.controller.siteparsingprofile; +import org.jsoup.nodes.Document; import org.junit.BeforeClass; import org.junit.Test; @@ -14,7 +15,10 @@ public class MissAVParsingProfileTest { public static void initialize() throws IOException { parser = new moviescraper.doctord.controller.siteparsingprofile.specific.MissAVParsingProfile(); var result = parser.getSearchResults(parser.createSearchStringFromId("DANDY-680")); - parser.setDocument(SiteParsingProfile.getDocument(result[0])); + var response = SiteParsingProfile.getDocument(result[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + parser.setDocument(response.parse()); parser.prepareData(); } diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MyTokyoHotParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MyTokyoHotParsingProfileTest.java index 7675464f..f1da30e8 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MyTokyoHotParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/MyTokyoHotParsingProfileTest.java @@ -35,7 +35,10 @@ public static void initialize() { String searchString = parser.createSearchString(file); try { SearchResult[] searchResults = parser.getSearchResults(searchString); - Document document = SiteParsingProfile.getDocument(searchResults[0]); + var response = SiteParsingProfile.getDocument(searchResults[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + Document document = response.parse(); parser.setDocument(document); } catch (IOException e) { // TODO Auto-generated catch block diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/NJavParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/NJavParsingProfileTest.java index f41a7498..f1bd54d0 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/NJavParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/NJavParsingProfileTest.java @@ -16,8 +16,10 @@ public class NJavParsingProfileTest { public static void initialize() throws IOException { parser = new NJavParsingProfile(); var result = parser.getSearchResults("siro-5283"); - var doc = SiteParsingProfile.getDocument(result[0]); - parser.setDocument(doc); + var response = SiteParsingProfile.getDocument(result[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + parser.setDocument(response.parse()); parser.prepareData(); } diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/OnePondoParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/OnePondoParsingProfileTest.java index 03299bfb..2eee444f 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/OnePondoParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/OnePondoParsingProfileTest.java @@ -29,10 +29,11 @@ public static void initialize() { profile = new OnePondoParsingProfile(); String searchString = profile.createSearchString(file); System.out.println(searchString); - Document document; try { - document = profile.getDocument(searchString); - profile.setDocument(document); + var response = profile.getDocument(searchString); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + profile.setDocument(response.parse()); } catch (IOException ex) { Logger.getLogger(OnePondoParsingProfileTest.class.getName()).log(Level.SEVERE, null, ex); } diff --git a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/SquarePlusParsingProfileTest.java b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/SquarePlusParsingProfileTest.java index 4d2602ae..cfafd0bf 100644 --- a/src/test/java/moviescraper/doctord/controller/siteparsingprofile/SquarePlusParsingProfileTest.java +++ b/src/test/java/moviescraper/doctord/controller/siteparsingprofile/SquarePlusParsingProfileTest.java @@ -19,11 +19,11 @@ public static void initialize(){ profile = new SquarePlusParsingProfile(); var searchString = profile.createSearchStringFromId(fn); try { - profile.setDocument( - SiteParsingProfile.getDocument( - profile.getSearchResults(searchString)[0] - ) - ); + var response = SiteParsingProfile.getDocument(profile.getSearchResults(searchString)[0]); + if(response.statusCode() == 200) + throw new RuntimeException(String.valueOf(response.statusCode())); + profile.setDocument(response.parse()); + profile.prepareData(); } catch (IOException e){ System.err.println(e.getMessage()); }