From 983e83be4643ce2ed634a0d186e1465d71480029 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 18 Oct 2016 22:14:20 +0200 Subject: [PATCH 1/1] Use fallback queries for accessing the pirate bay --- .../pterodactylus/rhynodge/watchers/PirateBayEpisodeWatcher.java | 6 +++++- .../java/net/pterodactylus/rhynodge/watchers/PirateBayWatcher.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayEpisodeWatcher.java b/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayEpisodeWatcher.java index 23f9509..44b93e1 100644 --- a/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayEpisodeWatcher.java +++ b/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayEpisodeWatcher.java @@ -30,6 +30,7 @@ import net.pterodactylus.rhynodge.Watcher; import net.pterodactylus.rhynodge.filters.EpisodeFilter; import net.pterodactylus.rhynodge.filters.HtmlFilter; import net.pterodactylus.rhynodge.filters.torrents.PirateBayFilter; +import net.pterodactylus.rhynodge.queries.FallbackQuery; import net.pterodactylus.rhynodge.queries.HttpQuery; import net.pterodactylus.rhynodge.triggers.NewEpisodeTrigger; @@ -66,7 +67,10 @@ public class PirateBayEpisodeWatcher extends DefaultWatcher { private static Query createHttpQuery(String searchTerms, String proxyHost, int proxyPort) { try { - return new HttpQuery("http://uj3wazyk5u4hnvtk.onion/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0", proxyHost, proxyPort); + HttpQuery hiddenServiceQuery = new HttpQuery("http://uj3wazyk5u4hnvtk.onion/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0", proxyHost, proxyPort); + HttpQuery torQuery = new HttpQuery("http://thepiratebay.org/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0", proxyHost, proxyPort); + HttpQuery plainInternetQuery = new HttpQuery("http://thepiratebay.org/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0"); + return new FallbackQuery(hiddenServiceQuery, torQuery, plainInternetQuery); } catch (UnsupportedEncodingException uee1) { /* will not happen. */ return null; diff --git a/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayWatcher.java b/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayWatcher.java index fffee87..ef2ac11 100644 --- a/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayWatcher.java +++ b/src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayWatcher.java @@ -29,6 +29,7 @@ import net.pterodactylus.rhynodge.Trigger; import net.pterodactylus.rhynodge.Watcher; import net.pterodactylus.rhynodge.filters.HtmlFilter; import net.pterodactylus.rhynodge.filters.torrents.PirateBayFilter; +import net.pterodactylus.rhynodge.queries.FallbackQuery; import net.pterodactylus.rhynodge.queries.HttpQuery; import net.pterodactylus.rhynodge.triggers.NewTorrentTrigger; @@ -72,7 +73,10 @@ public class PirateBayWatcher extends DefaultWatcher { */ private static Query createHttpQuery(String searchTerms, String proxyHost, int proxyPort) { try { - return new HttpQuery("http://uj3wazyk5u4hnvtk.onion/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0", proxyHost, proxyPort); + HttpQuery hiddenServiceQuery = new HttpQuery("http://uj3wazyk5u4hnvtk.onion/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0", proxyHost, proxyPort); + HttpQuery torQuery = new HttpQuery("http://thepiratebay.org/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0", proxyHost, proxyPort); + HttpQuery plainInternetQuery = new HttpQuery("http://thepiratebay.org/search/" + URLEncoder.encode(searchTerms, "UTF-8") + "/0/3/0"); + return new FallbackQuery(hiddenServiceQuery, torQuery, plainInternetQuery); } catch (UnsupportedEncodingException uee1) { /* will not happen. */ return null; -- 2.7.4