How to determine that a given link is video or a weblink...as all link dont have extension as .mp4 or .3gp etc....viz http://www.youtube.com/results?search_query=comedy&aq=f (is a weblink) [http://www.youtube.com/watch?v=vt4X7zFfv4k][1] (is a video link) In order to call respective view as video or webview...
A:
The only way to be sure is to get the head of the url, follow all redirects and check the mimetype of the response.
Dominik
2010-07-17 04:57:45
Thank you for your help.... Hii i tried following:String texturl="vnd.youtube:x6nVGm_0DPE?vndapp=youtube_mobileURL url2;String contentType = null;try {url2 = new URL(texturl);try {contentType = ((HttpURLConnection) url2.openConnection()).getContentType(); }catch (IOException e) {Log.d("content type: ", contentType); }catch (MalformedURLException e) { //sth.Error: 07-20 16:49:18.901: WARN/System.err(446): java.net.MalformedURLException: Unknown protocol: vnd.youtubePlease suggest how to follow redirects....!!!
Placidnick
2010-08-20 20:20:28
A:
Thank you for your help.... Hii i tried following:
String texturl="vnd.youtube:x6nVGm_0DPE?vndapp=youtube_mobile&vndclient=mv-google&vndel=index";
URL url2;
String contentType = null;
try {
url2 = new URL(texturl);
try {
contentType = ((HttpURLConnection) url2.openConnection()).getContentType(); }
catch (IOException e) {
Log.d("content type: ", contentType); }
catch (MalformedURLException e) { //sth.
Error: 07-20 16:49:18.901: WARN/System.err(446): java.net.MalformedURLException: Unknown protocol: vnd.youtube
Please suggest how to follow redirects....!!!
Placidnick
2010-07-20 23:56:48