lscofield

Extract vidoza video node api

Jun 9th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. // Example video
  2. String video_url = "https://vidoza.net/x1l6wnmde215.html";
  3. String mp4 = null;
  4. String authJSON = "{\"auth\":\"\",\"skk\":\"your_app_key_from_config_file\"}";
  5. String apiurl = "http://yourdomain_or_ip_address/api/v1/vidoza";
  6.  
  7. // Getting direct url through api    
  8. String obj = Jsoup.connect(apiurl)
  9.             .timeout(TIMEOUT_HERE)
  10.             .data("source", encodeBase64(video_url))
  11.             .data("auth", encodeBase64(authJSON))
  12.             .method(Connection.Method.POST)
  13.             .ignoreContentType(true)
  14.             .execute().body();
  15.  
  16. if(obj != null && obj.contains("url")){
  17.     JSONObject json = new JSONObject(obj);
  18.  
  19.     if (json.getString("status").equals("ok"))
  20.         mp4 = json.getString("url");
  21.     // Finally mp4 contains some of these values
  22.     // is null ==> Connection error
  23.     // is empty ==> no link fetched or apiserver error or video go down
  24.     // is direct video url (.mp4 or .m3u8) and you can play it directly in any video player
  25. }
Add Comment
Please, Sign In to add comment