Reputation: 315
I am performing an https request to using android to facebook video url I am getting in response a video tag not containing the src of the video but when the tag on the web browser contains the src what I am getting :
<video height="720" width="720" preload="auto" class="_ox1" data-video-width="720" data-video-height="720" id="u_0_1"><div class="_ox1" data-flash="1" id="id_563318ccbadc99b34985536" data-fallback-markup="1" data-video-width="720" data-video-height="720" style="width:720px;height:720px"></div></video>
the tag in the browser :
<video height="720" width="720" preload="auto" class="_ox1" data-video-width="720" data-video-height="720" id="u_0_5" src="https://video-fra3-1.xx.fbcdn.net/hvideo-xaf1/v/t42.1790-2/11828108_966111320095232_778529263_n.mp4?efg=eyJybHIiOjMwMCwicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoicWZfNDI2d19jcmZfMjNfbWFpbl8zLjBfcDFoY19zZCJ9&rl=300&vabr=80&oh=b7fe85321c8b179be254a93690b1e15a&oe=56333D2B" aria-owns="js_1" aria-haspopup="true" tabindex="0"><noscript data-reactid=".10"></noscript></video>
My http request code :
URL obj = new URL("https://www.facebook.com/3a2ilati/videos/1003710002994516/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", "Mozilla/5.0");
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) { // success
BufferedReader in = new BufferedReader(new InputStreamReader(
con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
so what should I do to display the src ?
Upvotes: 2
Views: 286
Reputation: 315
I have solve it , it seems that facebook does not gives the link directly until the user press the play button so I got the html to a web view the executing javascript code via javascript interface which is video.pause() to get the src of the video
Upvotes: 1