diff --git a/SampleUsageSession.png b/SampleUsageSession.png new file mode 100644 index 0000000..b023543 Binary files /dev/null and b/SampleUsageSession.png differ diff --git a/imdbTitleSearch/build.xml b/imdbTitleSearch/build.xml new file mode 100644 index 0000000..08f1695 --- /dev/null +++ b/imdbTitleSearch/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project imdbTitleSearch. + + + diff --git a/imdbTitleSearch/build/built-jar.properties b/imdbTitleSearch/build/built-jar.properties new file mode 100644 index 0000000..d5980b6 --- /dev/null +++ b/imdbTitleSearch/build/built-jar.properties @@ -0,0 +1,4 @@ +#Mon, 17 Oct 2016 23:52:39 -0400 + + +L\:\\Internship\\imdbTitleSearch= diff --git a/imdbTitleSearch/build/classes/imdbtitlesearch/ImdbTitleSearch.class b/imdbTitleSearch/build/classes/imdbtitlesearch/ImdbTitleSearch.class new file mode 100644 index 0000000..3c1d7d9 Binary files /dev/null and b/imdbTitleSearch/build/classes/imdbtitlesearch/ImdbTitleSearch.class differ diff --git a/imdbTitleSearch/dist/README.TXT b/imdbTitleSearch/dist/README.TXT new file mode 100644 index 0000000..7d5f81a --- /dev/null +++ b/imdbTitleSearch/dist/README.TXT @@ -0,0 +1,32 @@ +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "imdbTitleSearch.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, these files (folders) +are not copied. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/imdbTitleSearch/dist/imdbTitleSearch.jar b/imdbTitleSearch/dist/imdbTitleSearch.jar new file mode 100644 index 0000000..f07588c Binary files /dev/null and b/imdbTitleSearch/dist/imdbTitleSearch.jar differ diff --git a/imdbTitleSearch/dist/lib/jsoup-1.9.2.jar b/imdbTitleSearch/dist/lib/jsoup-1.9.2.jar new file mode 100644 index 0000000..bf38e1a Binary files /dev/null and b/imdbTitleSearch/dist/lib/jsoup-1.9.2.jar differ diff --git a/imdbTitleSearch/manifest.mf b/imdbTitleSearch/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/imdbTitleSearch/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/imdbTitleSearch/nbproject/build-impl.xml b/imdbTitleSearch/nbproject/build-impl.xml new file mode 100644 index 0000000..3546f79 --- /dev/null +++ b/imdbTitleSearch/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/imdbTitleSearch/nbproject/genfiles.properties b/imdbTitleSearch/nbproject/genfiles.properties new file mode 100644 index 0000000..8a232b8 --- /dev/null +++ b/imdbTitleSearch/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=384458ce +build.xml.script.CRC32=8a330523 +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=384458ce +nbproject/build-impl.xml.script.CRC32=315dd493 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/imdbTitleSearch/nbproject/private/private.properties b/imdbTitleSearch/nbproject/private/private.properties new file mode 100644 index 0000000..5d2d0f2 --- /dev/null +++ b/imdbTitleSearch/nbproject/private/private.properties @@ -0,0 +1,7 @@ +application.args=scissors +compile.on.save=true +do.depend=false +do.jar=true +javac.debug=true +javadoc.preview=true +user.properties.file=C:\\Users\\Roman\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/imdbTitleSearch/nbproject/private/private.xml b/imdbTitleSearch/nbproject/private/private.xml new file mode 100644 index 0000000..c54a9f0 --- /dev/null +++ b/imdbTitleSearch/nbproject/private/private.xml @@ -0,0 +1,9 @@ + + + + + + file:/L:/Internship/imdbTitleSearch/src/imdbtitlesearch/ImdbTitleSearch.java + + + diff --git a/imdbTitleSearch/nbproject/project.properties b/imdbTitleSearch/nbproject/project.properties new file mode 100644 index 0000000..c1cf79e --- /dev/null +++ b/imdbTitleSearch/nbproject/project.properties @@ -0,0 +1,78 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=imdbTitleSearch +application.vendor=usager +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/imdbTitleSearch.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.jsoup-1.9.2.jar-1=L:\\Internship\\jsoup-1.9.2.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.jsoup-1.9.2.jar-1} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=imdbtitlesearch.ImdbTitleSearch +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/imdbTitleSearch/nbproject/project.xml b/imdbTitleSearch/nbproject/project.xml new file mode 100644 index 0000000..4dc6eff --- /dev/null +++ b/imdbTitleSearch/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + imdbTitleSearch + + + + + + + + + diff --git a/imdbTitleSearch/src/imdbtitlesearch/ImdbTitleSearch.java b/imdbTitleSearch/src/imdbtitlesearch/ImdbTitleSearch.java new file mode 100644 index 0000000..30e79fd --- /dev/null +++ b/imdbTitleSearch/src/imdbtitlesearch/ImdbTitleSearch.java @@ -0,0 +1,79 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package imdbtitlesearch; + + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import java.net.*; +import java.io.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.jsoup.select.Elements; + +/** + * + * @author Roman Novitski + */ +public class ImdbTitleSearch { + + /** + * @param args the command line arguments + */ +public static void main(String[] args) { + if(args.length==0) + System.out.println("The input parameter is Missing!"); + else + scrapeTitle("http://www.imdb.com/find?ref_=nv_sr_fn&q="+args[0]+"&s=tt"); + +} +public static void scrapeTitle(String url){ + String html = getUrl(url); + Document doc = Jsoup.parse(html); + //System.out.println(doc); + Elements el=doc.select(".result_text"); + if(el.first()!=null){ + String content = el.first().text(); + String pattern = "[(][0-9]{4}[)]"; + + Pattern r = Pattern.compile(pattern); + Matcher m = r.matcher(content); + if (m.find( )) { + String year=m.group(0); + String title=content.replace(year, ""); + System.out.println("Title: " +title+"\nYear: "+year); + } + }else + System.out.println("Nothing found!"); +} +public static String getUrl(String url){ + URL urlObj = null; + try{ + urlObj = new URL(url); + } + catch(MalformedURLException e){ + System.out.println("The url was malformed!"); + return ""; + } + URLConnection urlCon = null; + BufferedReader in = null; + String outputText = ""; + try{ + urlCon = urlObj.openConnection(); + in = new BufferedReader(new InputStreamReader(urlCon.getInputStream())); + String line = ""; + while((line = in.readLine()) != null){ + outputText += line; + } + in.close(); + }catch(IOException e){ + System.out.println("There was an error connecting to the URL"); + return ""; + } + return outputText; +} + +}