30 lines
703 B
Java
30 lines
703 B
Java
package de.mrbesen.youtubecrawler;
|
|
|
|
import java.io.IOException;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.util.Scanner;
|
|
|
|
import javax.net.ssl.HttpsURLConnection;
|
|
|
|
public class HTTPS {
|
|
|
|
private HttpsURLConnection con;
|
|
|
|
public HTTPS(String url) throws MalformedURLException, IOException {
|
|
con = (HttpsURLConnection) (new URL(url)).openConnection();
|
|
con.setDoInput(true);
|
|
con.setDefaultUseCaches(true);
|
|
}
|
|
|
|
public String getContent() throws IOException {
|
|
StringBuilder sb = new StringBuilder();
|
|
Scanner in = new Scanner(con.getInputStream());
|
|
while(in.hasNextLine()) {
|
|
sb.append(in.nextLine()).append('\n');
|
|
}
|
|
in.close();
|
|
return sb.toString();
|
|
}
|
|
}
|