Search code examples
javascriptgoogle-drive-apiraw-data

Google Drive raw data?


Is there any URL google has that contains the raw data for the file? using https://drive.google.com/file/d/FILE_ID just takes you to a 'share' section of the file... say I have a .js file on GDrive. If you go to their share link, they have a share page. Is there any link to get the raw javascript from the file, as to use in a <script src="google_link_or_whatever">?


Solution

  • NOTE - THIS WAS THE SOLUTION BUT IT NO LONGER WORKS - SEE COMMENT BY @Bobby Fritze below

    No API's and no JS necessary. Confirmed now working on latest version of Drive. Great workaround for if your server doesn't use https but a vendor plugin demands https to call in a CSS or other file:

    1. On the folder with your intended file (e.g. FILE.css), hit Sharing Settings, then Advanced, then select "Public on the web - Anyone on the Internet can find and view."
    2. In the URL bar (or share link), copy everything after the drive.google.com/drive/u/0/folders/
    3. Use that ID to replace the XX-XXXXXXXXXXXXX in: http://googledrive.com/host/XX-XXXXXXXXXXXXX/FILE.css
    4. Navigate to the appended URL in Step 3 and you will now see your raw data.

    My use case below:

    <script type="text/javascript">
    var vsDisableResize = false;
    var vsCssUrl =         'https://cbe7c864b9c1ae8d5be60c7fed3e467334a04d2f.googledrive.com/host/0B9ngkmVbo5T7TDhTTU81M25iNnc/cart.css';
    var vsWineryId = '850';
    var vsWineListId = '71';
    

    Credit to @chris.huh at: https://productforums.google.com/forum/#!topic/drive/MyD7dgLJaEo