我正在执行https请求以使用android到facebook视频网址 我正在回应一个不包含视频src的视频标签 但是当Web浏览器上的标记包含src时 我得到了什么:
<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>
浏览器中的标记:
<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>
我的http请求代码:
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();
那我该怎么办才能显示src?
答案 0 :(得分:1)
我已经解决了,似乎facebook没有直接给出链接,直到用户按下播放按钮所以我得到了html到web视图通过javascript接口执行javascript代码,这是video.pause()获取视频的src