Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid URI: The Authority/Host could not be parsed from very long url

Tags:

c#

http

uri

youtube

This is the actual url to a Youtube video, at this moment if you copy to your chrome browser you may watch the video. But when I try to create a request I get UriFormatException. What am I doing wrong?

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

http:/r6---sn-x5jjxnn-ogul.googlevideo.com/videoplayback?ratebypass=yes&ms=au&fexp=924615,912522,932260,910207,936330,916611,936117,936910,936913&source=youtube&sver=3&mv=m&itag=43&key=yt5&ip=119.72.195.38&upn=cBXbXj9uR-k&ipbits=0&id=e9b0fb53c92a23c0&expire=1391346085&sparams=id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1391322689&fallback_host=tc.v17.cache3.googlevideo.com&signature=EC0116EE4A09D80D38ACB1302F6776320D55A20C.518C15D3446E72D5E764D93AFBA0804B9257914F

like image 288
electricalbah Avatar asked Feb 02 '14 06:02

electricalbah


2 Answers

The offender was this guy "http:/r". A quick hack for it is the code below

 if (url.StartsWith("http:/r"))
            url = url.Replace("http:/r", "http://r");

might modify it later for something general

like image 72
electricalbah Avatar answered Oct 05 '22 23:10

electricalbah


Check your browser when navigating to this URL, as it is redirected to http://r2....

Copy the redirected URL and use it instead:

http://r2---sn-aigeznl6.googlevideo.com/videoplayback?ratebypass=yes&fexp=924615,912522,932260,910207,936330,916611,936117,936910,936913&source=youtube&sver=3&itag=43&key=yt5&ip=119.72.195.38&upn=cBXbXj9uR-k&ipbits=0&id=e9b0fb53c92a23c0&expire=1391346085&sparams=id,ip,ipbits,itag,ratebypass,source,upn,expire&fallback_host=tc.v17.cache3.googlevideo.com&signature=EC0116EE4A09D80D38ACB1302F6776320D55A20C.518C15D3446E72D5E764D93AFBA0804B9257914F&redirect_counter=1&cms_redirect=yes&ms=nxu&mt=1391323695&mv=m

like image 45
barak manos Avatar answered Oct 06 '22 00:10

barak manos