diff --git a/src/main/java/net/Broken/Commands/Over18/SM.java b/src/main/java/net/Broken/Commands/Over18/SM.java index 73d07c5..45ed50d 100644 --- a/src/main/java/net/Broken/Commands/Over18/SM.java +++ b/src/main/java/net/Broken/Commands/Over18/SM.java @@ -20,11 +20,12 @@ public class SM implements Commande { Redirection redirect= new Redirection(); try { String redirectUrl = redirect.get("https://bonjourfetish.tumblr.com/random"); + logger.debug(redirectUrl); String img = FindContentOnWebPage.doYourJob(redirectUrl, "article-picture center", "img"); event.getTextChannel().sendMessage(img).queue(); } catch (IOException e) { - logger.warn("Erreur de redirection."); - event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection (5 essais), Réessayez__**:warning: ").queue(); + logger.warn("Redirection fail."); + event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Redirection fail (5 attempt), Try again__**:warning: ").queue(); } } diff --git a/src/main/java/net/Broken/Tools/FindContentOnWebPage.java b/src/main/java/net/Broken/Tools/FindContentOnWebPage.java index a815426..13d527b 100644 --- a/src/main/java/net/Broken/Tools/FindContentOnWebPage.java +++ b/src/main/java/net/Broken/Tools/FindContentOnWebPage.java @@ -39,7 +39,7 @@ public class FindContentOnWebPage { public static String getSourceUrl(String url) throws IOException { URL urlC = new URL(url); URLConnection yc = urlC.openConnection(); - yc.setRequestProperty("User-Agent","Googlebot"); + yc.setRequestProperty("User-Agent","Googlebot/2.1 (+http://www.googlebot.com/bot.html)"); BufferedReader in = new BufferedReader(new InputStreamReader( yc.getInputStream(), "UTF-8")); String inputLine; diff --git a/src/main/java/net/Broken/Tools/Redirection.java b/src/main/java/net/Broken/Tools/Redirection.java index f685135..3009a0c 100644 --- a/src/main/java/net/Broken/Tools/Redirection.java +++ b/src/main/java/net/Broken/Tools/Redirection.java @@ -24,7 +24,7 @@ public class Redirection { public String get(String urlString) throws IOException { System.setProperty("http.agent","Googlebot"); URLConnection con = new URL(urlString).openConnection(); - con.setRequestProperty("User-Agent","Googlebot"); + con.setRequestProperty("User-Agent","Googlebot/2.1 (+http://www.googlebot.com/bot.html)"); //System.out.println( "orignal url: " + con.getURL() ); con.connect(); //System.out.println( "connected url: " + con.getURL() ); diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2bf6cb0..b45a70b 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -3,7 +3,7 @@
- +