aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Jha <prashant.kumarjha63@gmail.com>2019-04-19 16:50:28 +0530
committerPrashant Jha <prashant.kumarjha63@gmail.com>2019-04-19 16:50:28 +0530
commiteaf34cc543a99fdb2ddbd59a9af1b3623f23a7bb (patch)
tree0b96da785562e46e68c74e6a214902853d3c85a3
parenta0d59a0807b43e3c47097980a2360008334ec928 (diff)
downloadtmdb-desktop-client-eaf34cc543a99fdb2ddbd59a9af1b3623f23a7bb.tar.gz
tmdb-desktop-client-eaf34cc543a99fdb2ddbd59a9af1b3623f23a7bb.zip
FinalFile
-rw-r--r--tmdb.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/tmdb.java b/tmdb.java
new file mode 100644
index 0000000..4b745c7
--- /dev/null
+++ b/tmdb.java
@@ -0,0 +1,41 @@
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import org.json.*;
+import javax.swing.*;
+
+public class tmdb{
+ static String api_key="b888b64c9155c26ade5659ea4dd60e64"; //TMDB API KEY
+ static String a_url="https://api.themoviedb.org/4/"; //ROOT URL FOR TMDB API
+
+ public static void main(String [] args){
+ try{
+
+ // }
+ // catch{
+ // {
+ // }
+ //}
+
+ //static void search(String mov){ //function for searching a movie
+ String s_url=a_url+"search/movie?api_key="+api_key+"&query=%s"; //General URL format for finding a movie
+ String url=String.format(s_url,"CARS"); //Adding the query
+ URL us1 = new URL(url); //Creating url object
+ InputStream sres = (InputStream)us1.getContent(); //Storing the stream of data we get from the url
+ JSONArray ja = new JSONArray(new JSONTokener(sres));
+ System.out.println(ja.toString(4));
+ }
+ catch(MalformedURLException e){
+ System.out.println(e);
+ }
+ catch(IOException e){
+ System.out.println(e);
+ }
+
+
+ }
+}
+