3

When i click url:

https://youtu.be/rCiqxFuRi6o?rel=0&wmode=transparent

It redirects to

https://www.youtube.com/watch?v=rCiqxFuRi6o&feature=youtu.be&rel=0&wmode=transparent

How to get programatically from android app this redirected link?

I want finally to get youtube video id.

Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
  • 2
    possible duplicate of [java, android, resolve an url, get redirected uri](http://stackoverflow.com/questions/5204599/java-android-resolve-an-url-get-redirected-uri) – hichris123 Aug 30 '15 at 00:42

1 Answers1

1

when you connect to https://youtu.be/rCiqxFuRi6o?rel=0&wmode=transparent

you'll get http 302 status (redirection) :

HTTP/1.1 302 Found
Date: Thu, 07 May 2015 14:25:38 GMT
Server: gwiseguy/2.0
Location: https://www.youtube.com/watch?v=rCiqxFuRi6o&feature=youtu.be
Content-Length: 0
Content-Type: text/html
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN

so you just need to read the Location header from the http response header.

Yosef-at-Panaya
  • 676
  • 4
  • 13