Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example video
- String video_url = "https://vidoza.net/x1l6wnmde215.html";
- String mp4 = null;
- String authJSON = "{\"auth\":\"\",\"skk\":\"your_app_key_from_config_file\"}";
- String apiurl = "http://yourdomain_or_ip_address/api/v1/vidoza";
- // Getting direct url through api
- String obj = Jsoup.connect(apiurl)
- .timeout(TIMEOUT_HERE)
- .data("source", encodeBase64(video_url))
- .data("auth", encodeBase64(authJSON))
- .method(Connection.Method.POST)
- .ignoreContentType(true)
- .execute().body();
- if(obj != null && obj.contains("url")){
- JSONObject json = new JSONObject(obj);
- if (json.getString("status").equals("ok"))
- mp4 = json.getString("url");
- // Finally mp4 contains some of these values
- // is null ==> Connection error
- // is empty ==> no link fetched or apiserver error or video go down
- // is direct video url (.mp4 or .m3u8) and you can play it directly in any video player
- }
Add Comment
Please, Sign In to add comment