How to get the correct redirect URL in java or Android? -
for example, url:
http://f.youku.com/player/getflvpath/sid/137619797659700_01/st/mp4/fileid/0300200100503c2912cacf06f7b7be321d4b39-09c7-d266-1dc7-72fbd749e129?k=d69a130f56086ce92828d4e4&hd=0&ts=26
when copy url in firefox , go, change
http://117.27.153.211/youku/6971f2c094c4578e17dbe318a/0300200100503c2912cacf06f7b7be321d4b39-09c7-d266-1dc7-72fbd749e129.mp4
in project, second link in string further use.
how redirected url??
this give redirected url
final url url = new url("http://www.google.com"); httpurlconnection urlconnection = (httpurlconnection) url .openconnection(); system.out.println(urlconnection.geturl().gethost());
the last line prints redirected url of given url
Comments
Post a Comment