diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..a5837a3 --- /dev/null +++ b/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..d811caa --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + YoutubeScraper + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/lib/commons-io-2.5.jar b/lib/commons-io-2.5.jar new file mode 100644 index 0000000..1234918 Binary files /dev/null and b/lib/commons-io-2.5.jar differ diff --git a/lib/jsoup-1.10.1.jar b/lib/jsoup-1.10.1.jar new file mode 100644 index 0000000..b75189d Binary files /dev/null and b/lib/jsoup-1.10.1.jar differ diff --git a/lib/ui4j-ide-1.1.0.jar b/lib/ui4j-ide-1.1.0.jar new file mode 100644 index 0000000..8ddbb15 Binary files /dev/null and b/lib/ui4j-ide-1.1.0.jar differ diff --git a/src/YouTubeScraper.java b/src/YouTubeScraper.java index 8e31595..bb7b731 100644 --- a/src/YouTubeScraper.java +++ b/src/YouTubeScraper.java @@ -2,10 +2,10 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; -import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; import java.util.Scanner; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; import org.apache.commons.io.FileUtils; import org.jsoup.Jsoup; @@ -29,92 +29,92 @@ public static void main(String[] args) throws IOException, InterruptedException{ //closing in on the target,(class name is lockup-title) Elements subdiv = website.select("h3.yt-lockup-title>a"); //System.out.println(subdiv);---checking to see if .select worked - String[] seperateLinks = new String[subdiv.size()]; - String[] title = new String[subdiv.size()]; - int i =0; + List separateLinks = new ArrayList<>(); + List titles = new ArrayList<>(); for(Element temp:subdiv) - { String a = temp.attr("href"); - //youtube has playlists, and these contail "list" in the URL and we dont need these playlists + { + String a = temp.attr("href"); + //youtube has playlists, and these contail "list" in the URL and we dont need these playlists if(a.contains("list")) { continue; } else{ //adding the non playlist URL's into my link array - seperateLinks[i] = "https://www.youtube.com"+temp.attr("href"); - title[i] = temp.text(); - i++; + separateLinks.add("https://www.youtube.com"+temp.attr("href")); + titles.add(temp.text()); } } - for(int j=0; j