#Drive-out
welcome to Drive-out, the node "exporter" for google drive. It extract html contents from Google Documents and allows you to download images, videos and other non-text contents. This installation comes with a reasonably complete website that gives you a "preview" of your google drive folder contents.
- Applying for a Google ClientID
You will need to apply for a a google Client ID for native application in order to get the data from google drive. You can use a google account to apply and retrieve your credentials at google developer console.
You then need to place these credentials in the settings.js
file.
Once you have logged in with your google account, follow these steps:
- Create a new project
- Under APIs & Auth / APIs enable DriveAPI by setting its status to ON
- Under APIs & Auth / Credentials click on create new Client ID and then select
Installed application
for Application type andOther
when the Installed Application Type panel appears. - Under APIs & Auth / Concsent Screen select an EMAIL ADDRESS and give a PRODUCT NAME to your application.
Remember to doublecheck the google drive api credentials, the application name, email and product Name.
- Installation on UNIX
Driveout needs node library because it uses bower and grunt-cli as well. Open your terminal and type:
npm install -g bower
npm install -g grunt
Git-cloned (e.g under ~~/
) and install the dependencies required by drive_api.js:
cd ~~/drive-out
npm install
bower install
Copy the settings.js
file
cp settings.js.example settings.js
and fill it with Google clientID credentials. Put then in between the quotes:
settings.CLIENT_ID = 'YOUR GOOGLE CLIENT ID.apps.googleusercontent.com';
settings.CLIENT_SECRET = 'YOUR GOOGLE CLIENT SECRET';
settings.REDIRECT_URL = 'YOUR GOOGLE REDIRECT_URL';
- Installation on Windows
...
- Get the data ...
Now comes the tricky part.
First of all, get the sharing link for the google drive folder you want to drive-out, something like https://drive.google.com/folderview?id=XXXXXXXXXXX&usp=sharing
.
Please note that the shared folder can belong to any other google account - that's why you need to authorize the drive-out application to read the shared folder (Cfr. step 1).
Complete the settings.js
file with the following line:
settings.DRIVE_FOLDER_URL = 'https://drive.google.com/folderview?id=XXXXXXXXXXX&usp=sharing';
Drive_out will ask Google for a Oauth2 token using your credentials and it will store these data it in a file named secrets.json
in a file location of your choice, just ensure it is an absolute path (with slash).
settings.SECRETS_PATH = './secrets.json';
- start your engines
In order to get the data from your google drive folder type:
npm start
copy the link after this line and paste in your browser address bar
Please visit the following url and authenticate with your google drive credentials:
Normally you will be asked for your google credentials (again) and you should then receive a code. Copy and paste the code into the terminal:
Enter the code here:
and wait for the indexer to finish its job.
As you may see, two folders have now been created in your driveout installation folder: ~~/drive-out/app/contents
and ~~/drive-out/app/media
.
Inside the media
folder you find a copy of each non-text file, while the Contents
folder will contain all your text contents translated into JSON structured files.
Please refer to index.js file to understand how drive-out exports your files, and modify it according to your needs.
- ... and run
Run the Grunt server to check that everything is in place:
grunt serve
or
grunt build
and copy the dist path to your server root.