0

I have a Python script that downloads audio attachments and transcribes them. Many of the files it is sent however are large. Google turns these files greater than 25MB into Google Drive links instead of regular attachments.

(As an aside, I found a way to download the files through the Google Drive API but then had the awful trouble of removing them -- as they are not owned by me and result in lots of 403's.)

I'm simply wondering if there is a way I can download the attachment when it comes as a Google Drive link (without using the Drive API).

The method I am using now is taken from the official docs.

Any help is appreciated!

Nolence
  • 2,134
  • 15
  • 25
  • 1
    You want to download the files using the URL of shared file. If my understanding is correct, you can download it using the URL without the special authorization. So is this information useful for your situation? https://stackoverflow.com/questions/48133080/how-to-download-a-google-drive-url-via-curl-or-wget/48133859#48133859 If I misunderstand your question, I'm sorry. – Tanaike Jun 20 '18 at 04:36
  • That looks promising, Tanaike. Thank you. One thing I've been trying to figure out now is where I might find the file id in the response to my Gmail get request. For example, here is a [link](https://github.com/Nolence/misc/blob/master/response.py) to the response object I've been working with it – Nolence Jun 20 '18 at 06:02
  • 1
    When the file ID could be retrieved, you can download it using the file ID. In that case, the file is required to be shared. – Tanaike Jun 20 '18 at 08:30
  • Sorry Tanaike, I think you misunderstood my question. I was wondering how I might get the file Id from gmail's response object as it wasn't explicitly labeled "file id." In any case I figured it out. I simply decoded the data in the payload and ended up with the html email with the embedded link to the drive file inside. Using Regex, I got it out just fine. Again, thank you! – Nolence Jun 20 '18 at 17:11
  • Thank you for the additional information. I'm sorry I misunderstood your situation. But I'm glad your issue was solved. – Tanaike Jun 20 '18 at 21:54
  • @Nolence Were you able to find a better solution than parsing the email body? – V.i.K.i Mar 15 '19 at 11:07
  • @V.i.K.i Afraid not. I also gave up on this project a while back and hardly remember the specifics. Please let me know though if you find a better way and I'll gladly mark your answer accepted – Nolence Mar 15 '19 at 17:00

0 Answers0