Jaggu
Jaggu

Reputation: 6428

How to get URL from this which can be pasted in browser?

I have a URL like this:

http%253A%252F%252Fo-o.preferred.bom03s03.v18.lscache5.c.youtube.com%252Fvideoplayback%253Fsparams%253Dalgorithm%25252Cburst%25252Ccp%25252Cfactor%25252Cid%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cexpire%2526fexp%253D906717%25252C903945%25252C912602%25252C913601%25252C901601%2526algorithm%253Dthrottle-factor%2526itag%253D34%2526ip%253D59.0.0.0%2526burst%253D40%2526sver%253D3%2526signature%253D904B7C772910BF285A6068BC1B5F5BB326A15A67.A0A3B85945C69A12B590D3D61695A3095039728D%2526source%253Dyoutube%2526expire%253D1331814444%2526key%253Dyt1%2526ipbits%253D8%2526factor%253D1.25%2526cp%253DU0hSRlhMUl9JTkNOMl9QRlZFOkVoSFJkckpoeHMw%2526id%253D4749aebe2c52addd

How can I get actual URL from this. I tried HttpUtility.UrlDecode and various other utility methods. But nothing seems to work. Can anybody tell me what is %253A and other characters. It seems to be Unicode but how do I get URL from this which can be actually pasted in browser?

Upvotes: 0

Views: 295

Answers (1)

Valamas
Valamas

Reputation: 24749

It is doubled encoded.

Try

Console.Write(HttpUtility.UrlDecode(HttpUtility.UrlDecode(@"http%253A%252F%252Fo-o.preferred.bom03s03.v18.lscache5.c.youtube.com%252Fvideoplayback%253Fsparams%253Dalgorithm%25252Cburst%25252Ccp%25252Cfactor%25252Cid%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cexpire%2526fexp%253D906717%25252C903945%25252C912602%25252C913601%25252C901601%2526algorithm%253Dthrottle-factor%2526itag%253D34%2526ip%253D59.0.0.0%2526burst%253D40%2526sver%253D3%2526signature%253D904B7C772910BF285A6068BC1B5F5BB326A15A67.A0A3B85945C69A12B590D3D61695A3095039728D%2526source%253Dyoutube%2526expire%253D1331814444%2526key%253Dyt1%2526ipbits%253D8%2526factor%253D1.25%2526cp%253DU0hSRlhMUl9JTkNOMl9QRlZFOkVoSFJkckpoeHMw%2526id%253D4749aebe2c52addd")));

Result:

http://o-o.preferred.bom03s03.v18.lscache5.c.youtube.com/videoplayback?sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip
%2Cipbits%2Citag%2Csource%2Cexpire&fexp=906717%2C903945%2C912602%2C913601%2C901601&algorithm=throttle-factor&itag=34&ip=
59.0.0.0&burst=40&sver=3&signature=904B7C772910BF285A6068BC1B5F5BB326A15A67.A0A3B85945C69A12B590D3D61695A3095039728D&sou
rce=youtube&expire=1331814444&key=yt1&ipbits=8&factor=1.25&cp=U0hSRlhMUl9JTkNOMl9QRlZFOkVoSFJkckpoeHMw&id=4749aebe2c52ad
dd

Upvotes: 3

Related Questions