1

I'm on Mac OSX trying to use telnet to get a file off of google drive. I found that the following link template causes an automatic download of a file off of google drive:

http://drive.google.com/uc?id=documentId&export=download

where documentId is the id of the document (a combination of numbers and letters). So I go to the terminal, type telnet drive.google.com 80 and get connected to the server. Then I type GET /uc?id=documentId&export=download HTTP/1.1, press enter, type Host: drive.google.com, then press enter twice.

I'm pretty sure I followed the steps correctly, but for some reason, I always get a status code of 302 Moved Temporarily. Did I enter the URL wrong, are there some characters that need to be escaped? Any suggestions would be helpful.

2 Answers 2

1

302 Moved Temporarily is not an error of any kind. It's the HTTP server telling you that the URL is okay but the actual content is at a different location; for example, it might be redirecting you to one of Google's storage servers, or asking to try again over HTTPS.

Look for a Location: header in the response and issue a second HTTP request for it (after connecting to the apropriate server if needed).

As a better alternative, try curl -L -o <filename> <url>.
(Add -v if you want to see the HTTP requests in action.)

4
  • is curl an actual command? Because I'm just using telnet to test out the HTTP request which later I'm going to use in a C++ program to download the file off the internet.
    – rcplusplus
    Jul 24, 2012 at 3:39
  • And also, the "new location" link it gives me is this: /uc?id=documentId&amp;export=download, which is the exact same thing [!] as the provided link save for the ampersand being replaced by &amp
    – rcplusplus
    Jul 24, 2012 at 3:43
  • @rcplusplus: If it has something different, then it's not exactly the same thing, is it? Jul 24, 2012 at 11:20
  • @rcplusplus: And yes, curl is an actual command, but it also comes with a libcurl library for C which is very convenient for downloading files over HTTP, among other things. Jul 24, 2012 at 11:21
0

Need to use HTTPS, do you have some kind of SSL-equipped telnet?

1
  • Tried it your way with openssl, and it worked! Well, it gave me HTML saying "Moved Temporarily" and then had a <a></a> element directing me to the file. All I do is click it and then the file downloads. And that URL is the Location: parameter in the response header
    – rcplusplus
    Jul 24, 2012 at 4:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .