From: David ‘Bombe’ Roden Date: Tue, 16 Jul 2024 18:19:41 +0000 (+0200) Subject: 💥 Fix Savoy filter X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d40375dc460e2f9a7e83a40922171150f9c5acd5;p=rhynodge.git 💥 Fix Savoy filter --- diff --git a/src/main/java/net/pterodactylus/rhynodge/watchers/SavoyTicketWatcher.java b/src/main/java/net/pterodactylus/rhynodge/watchers/SavoyTicketWatcher.java index c514e81..9701587 100644 --- a/src/main/java/net/pterodactylus/rhynodge/watchers/SavoyTicketWatcher.java +++ b/src/main/java/net/pterodactylus/rhynodge/watchers/SavoyTicketWatcher.java @@ -17,7 +17,7 @@ public class SavoyTicketWatcher extends DefaultWatcher { public SavoyTicketWatcher() { super( - new HttpQuery("https://savoy.premiumkino.de/programmwoche"), + new HttpQuery("https://savoy.premiumkino.de/programmweek"), asList( new HtmlFilter(), new SavoyTicketsFilter() diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt b/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt index 7f46077..e480854 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt @@ -12,7 +12,7 @@ class MovieExtractor { document.select("body script#flebbe-state") .dataNodes().joinToString("").unescape() .let(objectMapper::readTree) - .get("G./api/v1/de/config?").get("body").asText() + .get("G./api/v1/en/config?").get("body").asText() .let(objectMapper::readTree) .get("movie_list") .map { it.extractMovie() } diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt index 5fdfcb2..008c69c 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt @@ -2,19 +2,15 @@ package net.pterodactylus.rhynodge.filters.webpages.savoy import org.hamcrest.Description import org.hamcrest.Matcher -import org.hamcrest.MatcherAssert import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers -import org.hamcrest.Matchers.allOf +import org.hamcrest.Matchers.anything import org.hamcrest.Matchers.containsInAnyOrder -import org.hamcrest.Matchers.endsWith -import org.hamcrest.Matchers.startsWith +import org.hamcrest.Matchers.equalTo +import org.hamcrest.Matchers.hasItems import org.hamcrest.TypeSafeDiagnosingMatcher import org.jsoup.Jsoup import org.junit.Test -import java.io.IOException import java.time.LocalDateTime -import java.util.Optional /** * Unit test for [MovieExtractor]. @@ -22,174 +18,77 @@ import java.util.Optional class MovieExtractorTest { @Test - fun moviesAreLocated() { + fun `first movie is extracted correctly`() { assertThat( - movies, containsInAnyOrder( - movie( - "All of Us Strangers", "https://cdn.premiumkino.de/movie/2809/db0e5c3ed02ba7fe4afa3b12aabb611f.jpg", - allOf(startsWith("Sich neu verlieben, durch eine Zeitschleife"), endsWith("Quelle: disney-content.de")), - performance(LocalDateTime.of(2024, 2, 9, 16, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240209/1615/HkKdhlHMvtfSMy1fqYYtYuVdgGIKtnT7i7ddY5jzRfY~"), - performance(LocalDateTime.of(2024, 2, 10, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240210/2215/znWqm8FQUNSbrODY_A0jw8Au2nW6uSqbFE7Co8UgQv0~"), - performance(LocalDateTime.of(2024, 2, 11, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240211/2015/I642oTHBKpy7sz2RULHIQK6cykSCPi57_c0TApiKbUk~"), - performance(LocalDateTime.of(2024, 2, 12, 17, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240212/1715/2lEiqVP1hueXZhWwy9FSUfRgFKf8iTCKRMdJOTfBf8A~"), - performance(LocalDateTime.of(2024, 2, 13, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240213/2030/M0mIWdKm5gZkan5na6zOVFBzsHWAHhqod8RCmG2Fr0Y~"), - performance(LocalDateTime.of(2024, 2, 14, 14, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240214/1430/VZhgxh4PZutWWlLPEAe9dfOUJkB3sLnXzWoduICJYTk~") - ), - movie( - "Dune", "https://cdn.premiumkino.de/movie/3261/bcc70cb1cc4559731b6fd547d0f5cee1.jpg", - allOf(startsWith(""Dune" erzählt die packende Geschichte"), endsWith("Quelle: mediapass.warnerbros.com")), - performance(LocalDateTime.of(2024, 2, 9, 19, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240209/1900/o9jDuan4yyxaW7-Jg3hCJpiAM4CLZei8J2IX-O5-hA0~"), - performance(LocalDateTime.of(2024, 2, 10, 15, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240210/1530/jXbZnYD8R5djVnj3Ojjcsc9qdSJ0JBMVhn7PeP88HyY~"), - performance(LocalDateTime.of(2024, 2, 11, 13, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240211/1330/aJmlM8wOaGl_jtuWDvWG9TF7RR1zRpNrSZeArCBhn90~"), - performance(LocalDateTime.of(2024, 2, 12, 20, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240212/2000/2KLOCZy5zU060zKj-4zafxm3oalEyT4tNi2Fxnw5D7E~"), - performance(LocalDateTime.of(2024, 2, 13, 17, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240213/1700/QCphOtH-WrZ2tRbENwaxXPskrN2gH3I8dHR0Y5L3l0Y~") - ), - movie( - "SAVOY Sneak-Preview", "https://cdn.premiumkino.de/movie/5617/33dc4c74b4cca5cf4585b4cadfc38ec4.png", - allOf(startsWith("Wir zeigen unsere OV-Sneak freitagabends"), endsWith("Logenpreis 1,- Euro Ermäßigung. ")), - performance(LocalDateTime.of(2024, 2, 9, 22, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240209/2230/GtYBcOR_Jy7a8xDxwwPHI0wfY_v_Ep2P6rV0w4wJ7SM~"), - performance(LocalDateTime.of(2024, 2, 16, 22, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240216/2200/ZRC7iir9Hu8nIpH1PsiA_UDvckcj7yGqgMEYXHAs9Qw~") - ), - movie( - "Der Junge und der Reiher", "https://cdn.premiumkino.de/movie/4013/b129f329bc07315ccd9591fd2cde19b4.jpg", - performance(LocalDateTime.of(2024, 2, 10, 12, 30), "2D OmeU", "https://savoy.premiumkino.de/vorstellung/der-junge-und-der-reiher/20240210/1230/F0atZERI4Gssj3LGC-2fQlLF3rM9Uk8IbpOzHaXyx7w~") - ), - movie( - "Poor Things", "https://cdn.premiumkino.de/movie/1066/aba09af737677ff6a15676ae588098b1.jpg", - performance(LocalDateTime.of(2024, 2, 10, 19, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240210/1900/SqolavKZAlBMZH_JAN-OqdZqowBv-aRqhPGHvPTphao~"), - performance(LocalDateTime.of(2024, 2, 11, 17, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240211/1700/UrS33k-jY7_ZAsm4B7wydy0SBfdVjdd73On68HtIy9E~"), - performance(LocalDateTime.of(2024, 2, 13, 13, 45), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240213/1345/gma7KCzuaJQCSoBm8NMJb3ATjtMISm4M9IiwiVNpXpw~"), - performance(LocalDateTime.of(2024, 2, 14, 17, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240214/1715/cBjQj4qRrJaSX3m_acvfxNL1Tclg0Rrt_X63Md0rkEw~") - ), - movie( - "Vergiss mein nicht- Eternal Sunshine of the Spotless Mind", "https://cdn.premiumkino.de/movie/2641/963c11bfaccb7c66da0b6b25ea8ed299.jpg", - performance(LocalDateTime.of(2024, 2, 14, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/vergiss-mein-nicht-eternal-sunshine-of-the-spotless-mind/20240214/2030/QqoCtd4ls09AD04rGSNh8qPkf02rcRzp2wFfF2BoobE~") - ), - movie( - "Bob Marley: One Love", "https://cdn.premiumkino.de/movie/1243/772641b8454ce4ea28c5eb56ec74365f.jpg", - performance(LocalDateTime.of(2024, 2, 15, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/bob-marley-one-love/20240215/2015/q4dxyPDNVvZDEeIuh1r9Y4OJ7UK36CKSr2d7p3h9LMs~") - ), - movie( - "The Hateful 8", "https://cdn.premiumkino.de/movie/6651/164fd22df165c914f118f85ff0bd34aa.jpg", - performance(LocalDateTime.of(2024, 2, 18, 19, 45), "70mm OV", "https://savoy.premiumkino.de/vorstellung/the-hateful-8/20240218/1945/dusKDbTYgF79OipGmQO0Q4P5K02rclkjIV9At8qKfOA~") - ), - movie( - "Prinzessin Mononoke", "https://cdn.premiumkino.de/movie/6085/062bbdbbda9f86b7e066486412532369.jpg", - performance(LocalDateTime.of(2024, 2, 19, 20, 15), "2D OmeU", "https://savoy.premiumkino.de/vorstellung/prinzessin-mononoke/20240219/2015/LmbLtOrTZxBgPlBMzoRZ4_C-PfO64GeXNIKr5KGs-2M~"), - performance(LocalDateTime.of(2024, 2, 22, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/prinzessin-mononoke/20240222/2015/mvbGK2fA5AgPbADOzm7sqFYYzm2qdqqdwqdLu4rMPrg~") - ), - movie( - "Das fünfte Element (Best of Cinema)", "https://cdn.premiumkino.de/movie/2861/69770d12a16f13df00b70cb830b9d75b.jpg", - performance(LocalDateTime.of(2024, 2, 20, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/das-fuenfte-element-best-of-cinema/20240220/2030/QcJZ5Yh8P2j_HKLSP8cjcXsqkbdqYdYGTexCF3RF2R4~") - ), - movie( - "Heaven Can Wait - wir leben jetzt", "https://cdn.premiumkino.de/movie/3191/b9698912f3fdec6bd72fe66be9cab6f0.jpg", - performance(LocalDateTime.of(2024, 2, 21, 11, 0), "2D", "https://savoy.premiumkino.de/vorstellung/heaven-can-wait-wir-leben-jetzt/20240221/1100/GW7pwEYabwN3-e8uTGmSPTfdbyXoKe4la-B2L1SI8XI~") - ), - movie( - "Demon Slayer: Kimetsu no yaiba - Zum Training der Säulen", "https://cdn.premiumkino.de/movie/3478/96e87d7ec36c9c2b2d4ff2cc933c9401.jpg", - performance(LocalDateTime.of(2024, 2, 27, 20, 30), "2D OmeU", "https://savoy.premiumkino.de/vorstellung/demon-slayer-kimetsu-no-yaiba-zum-training-der-saeulen/20240227/2030/UsAsz9NQPZGfdyLelrAHZ50MXeoElhNIPcgg3unBR0o~") - ), - movie( - "Double Feature DUNE 1&2", "https://cdn.premiumkino.de/movie/7300/14d1b21dee51a82a7b096ca282bf01c8.png", - performance(LocalDateTime.of(2024, 2, 28, 17, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/double-feature-dune-1und2/20240228/1730/Ni6Yo0fA4k7gEZiJB8Cnq33Axjnw85JBG2lBIVRwYok~"), - performance(LocalDateTime.of(2024, 3, 3, 10, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/double-feature-dune-1und2/20240303/1000/AXcH4nnYJB9Ar0aR5zFl3Bfa238POna3UVY66_nHL6c~") - ), - movie( - "Dune: Part Two", "https://cdn.premiumkino.de/movie/4669/f0a036d58d75302739ea5680ab8405bc.jpg", - performance(LocalDateTime.of(2024, 2, 29, 12, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/1230/Osq78ODtBKchFFx1HgAmEPAAIWLC6JgxWqC638UaRws~"), - performance(LocalDateTime.of(2024, 2, 29, 16, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/1615/hJ3kXaFB-LjfZu2pYBVx0R_2UoqOJANwWX_AS4KW6FI~"), - performance(LocalDateTime.of(2024, 2, 29, 20, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/2000/EwA7Z5KlKNnIr0e4o_tXGpYp6xN90juBl92wcTVIZ-Q~"), - performance(LocalDateTime.of(2024, 3, 1, 13, 45), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/1345/-kxmskcNJYhWCr9z5MfK0p2w2qlu3CDu8rVtDLmxSQA~"), - performance(LocalDateTime.of(2024, 3, 1, 17, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/1730/yXQQSsMug0nRQGN1BNpBXEA3Udf_asggPHwk4a4zdBE~"), - performance(LocalDateTime.of(2024, 3, 1, 21, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/2115/FN7huOUR4eLA-2EKxi9lTykJUFQNYc4LTHRHtyDlAgo~"), - performance(LocalDateTime.of(2024, 3, 2, 10, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1000/84ntwEOFY6aqexIEd9tXESW6qrl9aXk-x2l-LsHWvfk~"), - performance(LocalDateTime.of(2024, 3, 2, 13, 45), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1345/9lxXFXQU6FHmyv1WpKX5ETpd24daZT16hNvXUJEUwik~"), - performance(LocalDateTime.of(2024, 3, 2, 17, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1730/ynmy2dsbgYygz2hPUS_vx-9YL13m2KZ0-9tw37XuBMQ~"), - performance(LocalDateTime.of(2024, 3, 2, 21, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/2115/rH8i8BAFaaDjfNJBbZjj_7CV2dzOWcEOzyL618KYQVo~"), - performance(LocalDateTime.of(2024, 3, 3, 16, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240303/1630/fU4VOzrp34B48KdsB1vpo2pi18sWSo2Tkknk03sO4HY~"), - performance(LocalDateTime.of(2024, 3, 3, 20, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240303/2015/b1yBhvNosqm0nbWju1aCfb7LRBhRnMo_Y_h0VLZwmr0~"), - performance(LocalDateTime.of(2024, 3, 4, 12, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/1230/DcGmb0KshRY0qv55Tuo4ydiJswd1H9wonrYGF1zGqQ0~"), - performance(LocalDateTime.of(2024, 3, 4, 16, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/1615/BEd4wzePEH_Sxxuum4cXpsoOubN8fA6oecrWpwGJpcc~"), - performance(LocalDateTime.of(2024, 3, 4, 20, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/2000/7Qldfc-0lDNALUw_lzuzM3KfarQWQAUi91qz2cMrNDk~"), - performance(LocalDateTime.of(2024, 3, 5, 12, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/1230/QiP6Vvb9htMnFyTSUZRte1b_Ykw_n_yzaGpErBLFjOE~"), - performance(LocalDateTime.of(2024, 3, 5, 16, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/1615/eY9ufKz1UM777apocN37PLvlsWwSJXc0xu7LMHecCbk~"), - performance(LocalDateTime.of(2024, 3, 5, 20, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/2000/2gqVyU2_3NXv_fZiiAxV8Utom82nPW52kzVxzUDrMkI~"), - performance(LocalDateTime.of(2024, 3, 6, 16, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240306/1600/Y8x2dIEq1QbEpZf7Td-6-3xqg-d4iDQU9p1fIjxJB0M~"), - performance(LocalDateTime.of(2024, 3, 6, 19, 45), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240306/1945/mSiOQk7DuM02IdmaVIvsv5nechCpRkWZwsK37hoXTyg~") - ), - movie( - "791 KM", "https://cdn.premiumkino.de/movie/2753/9585e7bd814dd2bef5d45427df2f2e92.jpg", - performance(LocalDateTime.of(2024, 3, 6, 11, 0), "2D", "https://savoy.premiumkino.de/vorstellung/791-km/20240306/1100/Mcvtz3tawhaIuyCtLtBkHwt6EI8b7oGXwh5OV4YWwNQ~") + movies, hasItems( + movie( + "Despicable Me 4", equalTo("https://cdn.premiumkino.de/movie/7055/e64f4cfe634f0f5e6f713bdc2ed8756a.jpg"), + equalTo("From supervillain to suburban family man? It can happen when your name is Gru (Oliver Rohrbeck), you meet your arch-enemy at the school reunion, things escalate and you have to go into hiding. But when baby Gru Junior is kidnapped, that's it for peace and quiet. Gru and his family set off on a crazy rescue mission. Along for the ride are the Minions, even more chaotic this time, because a super serum has turned five of them into Mega Minions with special abilities!"), + containsInAnyOrder( + isPerformance(LocalDateTime.of(2024, 7, 16, 15, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/ich-einfach-unverbesserlich-4/20240716/1515/ko5LhrFn1ySmp9WPawKSZhJ7MJpyho5zYK88MynBv-w~"), + isPerformance(LocalDateTime.of(2024, 7, 17, 14, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/ich-einfach-unverbesserlich-4/20240717/1430/9wpBlr25vJ00By1Kq9-PTnHXbqxSH0qkyetuITbUZko~"), + isPerformance(LocalDateTime.of(2024, 7, 18, 15, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/ich-einfach-unverbesserlich-4/20240718/1500/Lpotz2WxdYtLkA4uwYevsQ-uriKLePFUeBi2DAuj7Vc~"), + isPerformance(LocalDateTime.of(2024, 7, 19, 17, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/ich-einfach-unverbesserlich-4/20240719/1700/vBkX69rvF5-N2sSFAxjuLaeLJzNy1mYZEujpSH8Wlzw~"), + isPerformance(LocalDateTime.of(2024, 7, 20, 14, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/ich-einfach-unverbesserlich-4/20240720/1400/6DuekR1OMStVJVCktlCPYQaXE9ZBiBB7fDIlkWhpcYE~"), + isPerformance(LocalDateTime.of(2024, 7, 22, 14, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/ich-einfach-unverbesserlich-4/20240722/1400/4N6mDt75O57JKvcN43cGIKJRnpO6NFie2bW-dU-RHMc~"), + ) ), - movie( - "Following", "https://cdn.premiumkino.de/movie/3972/b2e687cfb6dffeb4f64acde41e7d286a.jpg", - performance(LocalDateTime.of(2024, 3, 9, 12, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/following/20240309/1200/-Aetrz3gC8l4rgVfGc98XXU7B87mTA4RCbWCgZuXHzc~") - ), - movie( - "Donnie Darko (Best of Cinema)", "https://cdn.premiumkino.de/movie/5245/05adfa102a8fb61f47727224369af706.jpg", - performance(LocalDateTime.of(2024, 3, 16, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/donnie-darko-best-of-cinema/20240316/2215/ZIBOwCyKuZ7A6OyYZWQ1AqF9O487dY_LAMmURYrGqUs~") - ), - movie( - "NT: Vanya", "https://cdn.premiumkino.de/movie/7449/cb5f27438bbffa247ca4081690f0ded9.jpg", - performance(LocalDateTime.of(2024, 3, 18, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240318/2030/X9L2eAn_XElOtZRg7u4eiQ6kUCqcuJhrwQ5T76OAt2s~"), - performance(LocalDateTime.of(2024, 3, 23, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240323/2215/xXgXAH_I7xX3GsQ4eA4rZsOOrJqAtK0hCCXexFMj0Fk~"), - performance(LocalDateTime.of(2024, 4, 8, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240408/2030/PDQ-R_ltFWo8QAn-BbloxETvgegcTyaQyCZrG_MwQfo~") - ), - movie( - "No Country For Old Men", "https://cdn.premiumkino.de/movie/1290/dcab4000b5b95ebcc4108906d9b4e0a1.jpg", - performance(LocalDateTime.of(2024, 3, 26, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/no-country-for-old-men/20240326/2015/jtZD6DfmChngY1mDGWlaaV8kZdUPL_QT2Fh-t0clBpU~") - ), - movie( - "Lisa Achatzi: Vom Traum zum Trauma - und zurück", "https://cdn.premiumkino.de/movie/7729/373dec2c25c06034c5d95e2d205a603c.jpg", - performance(LocalDateTime.of(2024, 4, 14, 12, 0), "2D", "https://savoy.premiumkino.de/vorstellung/lisa-achatzi-vom-traum-zum-trauma-und-zurueck/20240414/1200/MOLgymd988D7m8ZOvhM75aDc5suv3VO9aHobbLsaOgQ~") - ), - movie( - "Movie Quiz: Test Your Movie Knowledge", "https://cdn.premiumkino.de/movie/1702/ebfecdd4c3cacb6435ba2bffb84a6902.jpg", - performance(LocalDateTime.of(2024, 4, 15, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/movie-quiz-test-your-movie-knowledge/20240415/2015/DMAaL86yGoobZhPTDdU2ksO9RUTFoPCiQKGOY7TO6tg~") - ) ) ) } - private val movies: Collection = MovieExtractor().getMovies(loadDocument("savoy.html", "https://savoy.premiumkino.de/programmwoche")); + @Test + fun `all movies are extracted`() { + assertThat( + movies, containsInAnyOrder( + movie("Despicable Me 4"), + movie("MaXXXine"), + movie("The Rocky Horror Picture Show "), + movie("Zwischen uns das Leben"), + movie("Kinds of Kindness"), + movie("Inside Out 2"), + movie("Twisters"), + movie("Love Lies Bleeding"), + movie("SAVOY Sneak-Preview"), + movie("The Lord of the Rings: The Return of the King"), + movie("Gekijô-ban Blue Lock - Episode Nagi"), + movie("Harry Potter Quiz: Harry Potter and the Chamber of Questions"), + movie("Deadpool & Wolverine"), + movie("Paris, Texas"), + movie("Matrix"), + movie("Tomorrow is another day"), + movie("National Theatre Live | Present Laughter"), + movie("Rear Window"), + movie("Point Break"), + movie("Alien: Romulus"), + movie("Coraline"), + movie("Edward Scissorhands: Matthew Bourne’s Dance Version Of Tim Burton’s Classic"), + ) + ) + } -} + private val movies: Collection = MovieExtractor().getMovies(loadDocument("savoy.html", "https://savoy.premiumkino.de/programmwoche")); -private fun movie(name: String, imageUrl: String, vararg presentationTimesTypesAndLinks: Triple): Matcher { - return movie(name, imageUrl, Matchers.anything(), *presentationTimesTypesAndLinks) } -private fun movie(name: String, imageUrl: String, descriptionMatcher: Matcher, vararg presentationTimesTypesAndLinks: Triple): Matcher { +private fun movie(name: String, imageUrlMatcher: Matcher = anything(), descriptionMatcher: Matcher = anything(), presentationMatchers: Matcher> = anything()): Matcher { return object : TypeSafeDiagnosingMatcher() { override fun matchesSafely(movie: Movie, mismatchDescription: Description): Boolean { if (movie.name != name) { mismatchDescription.appendText("movie is named ").appendValue(movie.name) return false } - if (movie.imageUrl != imageUrl) { - mismatchDescription.appendText("image URL is ").appendValue(movie.imageUrl) + if (!imageUrlMatcher.matches(movie.imageUrl)) { + imageUrlMatcher.describeMismatch(movie.imageUrl, mismatchDescription) return false } if (!descriptionMatcher.matches(movie.description)) { descriptionMatcher.describeMismatch(movie.description, mismatchDescription) return false } - val performances = movie.performances.toMutableList() - if (performances.size != presentationTimesTypesAndLinks.size) { - mismatchDescription.appendText("has ").appendValue(performances.size).appendText(" presentations") - return false - } - for ((time, type, link) in presentationTimesTypesAndLinks) { - val foundLink = performances.find {( it.time == time) && (it.type == type) && (it.link == link) } - if (foundLink == null) { - mismatchDescription.appendValue("has no presentation at ").appendValue(time) - return false - } - performances -= foundLink - } - if (performances.isNotEmpty()) { - mismatchDescription.appendText("has no presentations at ").appendValueList("", ", ", "", performances) + val performances = movie.performances + if (!presentationMatchers.matches(performances)) { + presentationMatchers.describeMismatch(performances, mismatchDescription) return false } return true @@ -197,8 +96,9 @@ private fun movie(name: String, imageUrl: String, descriptionMatcher: Matcher() { + override fun matchesSafely(item: Performance, mismatchDescription: Description): Boolean { + if (item.time != dateTime) { + mismatchDescription.appendText("time is ").appendValue(item.time) + return false + } + if (item.type != type) { + mismatchDescription.appendText("type is ").appendValue(item.type) + return false + } + if (item.link != link) { + mismatchDescription.appendText("link is ").appendValue(item.link) + return false; + } + return true + } + + override fun describeTo(description: Description) { + description.appendText("performance at ").appendValue(dateTime) + .appendText(" with type ").appendValue(type) + .appendText(" and link ").appendValue(link) + } +} diff --git a/src/test/resources/net/pterodactylus/rhynodge/filters/webpages/savoy/savoy.html b/src/test/resources/net/pterodactylus/rhynodge/filters/webpages/savoy/savoy.html index e2557f9..e530e5a 100644 --- a/src/test/resources/net/pterodactylus/rhynodge/filters/webpages/savoy/savoy.html +++ b/src/test/resources/net/pterodactylus/rhynodge/filters/webpages/savoy/savoy.html @@ -1,6 +1,6 @@ - + - SAVOY Filmtheater Hamburg + SAVOY movie theatre Hamburg @@ -118,12 +118,11 @@ } - - -
00 Artikel

Wochenprogramm

Hier sehen Sie unser Programm, nach Kinowochen gruppiert.

-

Aktuelle Kinowoche

Heute

All of Us Strangers

All of Us Strangers

Dune

Dune

SAVOY Sneak-Preview

SAVOY Sneak-Preview

Sa. 10.02.

All of Us Strangers

All of Us Strangers

Dune

Dune

Der Junge und der Reiher

Der Junge und der Reiher

Poor Things

Poor Things

So. 11.02.

All of Us Strangers

All of Us Strangers

Dune

Dune

Poor Things

Poor Things

Mo. 12.02.

All of Us Strangers

All of Us Strangers

Dune

Dune

Di. 13.02.

All of Us Strangers

All of Us Strangers

Dune

Dune

Poor Things

Poor Things

Mi. 14.02.

Do. 15.02. - Mi. 21.02.

Do. 22.02. - Mi. 28.02.

Do. 29.02. - Mi. 06.03.

Sa. 09.03.

Sa. 16.03. - Mo. 18.03.

Sa. 23.03. - Di. 26.03.

Mo. 08.04.

So. 14.04. - Mo. 15.04.

0 Plätze gewählt
0 Plätze gewählt
00 Artikel

Ihre PayPal-Zahlung wird ausgeführt.

Ihre Zahlung wird bearbeitet.

Zahlung wird vorbereitet.

Ihre Zahlung mit Google Pay wird ausgeführt.

Ihre Zahlung mit Google Pay wird vorbereitet.

Ihre Zahlung mit Apple Pay wird ausgeführt.

Ihre Zahlung mit Apple Pay wird vorbereitet.

Ihre Gutschein-Zahlung wird ausgeführt.

Ihre kostenfreie Bestellung wird ausgeführt.

Ihre Kundenkarten-Zahlung wird ausgeführt.

- - - + + +
00 Articles

I'm sorry Dave,
I'm afraid
I can't do that

HAL 9000 (2001: Odyssey in Space) has analyzed that you probably have clicked on an old link or the desired page has been moved and thus unfortunately can not be reached via this link.

Maybe these pages will help you:

0 Seats selected

Your PayPal payment will be executed.

Your payment is being processed.

Payment is being prepared.

Your payment via Google Pay will be executed.

Your payment with Google Pay is being prepared.

Your payment via Apple Pay will be executed.

Your payment with Apple Pay is being prepared.

Your voucher payment will be executed.

Your free order will be executed.

Your loyalty card payment will be executed.

+ + + - \ No newline at end of file + \ No newline at end of file