ClaptrapBot/src/net/Broken/commandes/Over18/Pipe.java
2017-03-20 18:44:53 +01:00

49 lines
1.6 KiB
Java

package net.Broken.commandes.Over18;
import net.Broken.commandes.NumberedCommande;
import org.apache.logging.log4j.LogManager;
/**
* Created by seb65 on 07/11/2016.
*/
public class Pipe extends NumberedCommande {
public Pipe() {
super(LogManager.getLogger(), "http://feelation.com/");
}
/*
System.out.println("ok");
String pipeLine=null;
URL pipeURL = new URL(redirect.get("http://feelation.com/random"));
URLConnection cc = pipeURL.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(cc.getInputStream(), "UTF-8"));
String inputLine;
while ((inputLine = in.readLine()) != null)
{
System.out.println(inputLine);
if(inputLine.contains("class=\"post photo\""))
{
String[] splited = inputLine.split("<");
for(String aString:splited)
{
if(aString.startsWith("<img src"))
{
pipeLine=aString;
pipeLine=inputLine.replaceAll("<img src=\"","");
pipeLine=pipeLine.substring(0,pipeLine.indexOf("\""));
System.out.println(pipeLine);
break;
}
}
}
}
in.close();
event.getTextChannel().sendMessage(redirect.get("http://feelation.com/random")).queue();
*/
}