Partial Request made for a Google Drive file does not return the expected content

183 views Asked by At

I am working on a download manager. I tried to download a content from Google Drive. I used AddRange to get the file partially but despite Range:60000000-61000000 returns the correct size, the Range:600000000-610000000 returns -1. It doesnt overflow the file size which is almost 1.3GB. I dont understand why this problem happens. How can I fix it?

var tabUrl = "https://drive.google.com/u/0/uc?export=download&confirm=03hU&id=0B1eUy3QmH0GJMnMzOTd0ZmxBTWs";
var url = "https://doc-0g-b4-docs.googleusercontent.com/docs/securesc/lsbj6u3i2broqhjlhh1rgl1pur9nv89c/2ipaf9daok4r1ccc59df1knp3itb6ov6/1608404475000/05822274146576777383/05815548638186256017/0B1eUy3QmH0GJMnMzOTd0ZmxBTWs?e=download&authuser=0&nonce=carmpci74c5ie&user=05815548638186256017&hash=dm8janki6hh5u70h2t9t83t2gq922app";
var request = (HttpWebRequest)WebRequest.Create(url);
var whc = new WebHeaderCollection();
request.SetHeaderValue("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362");
request.AllowAutoRedirect = true;
request.Method = "GET";
request.Timeout = 30000;
request.KeepAlive = false;
request.ReadWriteTimeout = 3000;
before.Raise(null, new BeforeSendingRequestEventArgs(request));
request.AddRange(60000000, 61000000);

Request Headers As Json:

      {
         "name":"Sec-Fetch-User",
         "value":"?1"
      },
      {
         "name":"Sec-Fetch-Dest",
         "value":"document"
      },
      {
         "name":"sec-ch-ua",
         "value":"\"Google Chrome\";v=\"87\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"87\""
      },
      {
         "name":"sec-ch-ua-mobile",
         "value":"?0"
      },
      {
         "name":"Referer",
         "value":"https://drive.google.com/"
      },
      {
         "name":"Accept-Encoding",
         "value":"gzip, deflate, br"
      },
      {
         "name":"Accept-Language",
         "value":"tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7"
      },
      {
         "name":"Cookie",
         "value":"AUTH_r6g6bi1696lsg9bjdc9ud1ssvo24su70_nonce=carmpci74c5ie"
      }
   ],
   "taburl":"https://drive.google.com/u/0/uc?export=download&confirm=03hU&id=0B1eUy3QmH0GJMnMzOTd0ZmxBTWs",
   "url":"https://doc-0g-b4-docs.googleusercontent.com/docs/securesc/lsbj6u3i2broqhjlhh1rgl1pur9nv89c/2ipaf9daok4r1ccc59df1knp3itb6ov6/1608404475000/05822274146576777383/05815548638186256017/0B1eUy3QmH0GJMnMzOTd0ZmxBTWs?e=download&authuser=0&nonce=carmpci74c5ie&user=05815548638186256017&hash=dm8janki6hh5u70h2t9t83t2gq922app",
   "filename":"Ins.rar",
   "size":0
}
0

There are 0 answers