There are two ways to go about:
- Method 1 is hard and long but might give you better performance and you need to make your own google cloud project thingy.
- Method 2 relies on rclones google cloud project saving you the burden of having to create your own project i.e. you get to skip the next 15 steps.
- Go to https://console.cloud.google.com/projectcreate
- Name the project whatever you want and click create.
- Next to "Google Cloud Platform," click the Down arrow and select your project.
- At the top-left corner, click the hamburger menu icon: Click APIs & Services > Credentials.
- Click Configure Consent Screen. The "OAuth consent screen" screen appears.
- Set user type to external and click create.
- Fill in the required details, you can give your own email as dev and support email. Click save and continue.
- For the scopes page leave it as it is and click save and continue.
- Now add yourself (your email id) as the test user by pressing add users. Click save and continue.
- Now on your left, under API & Services, you will see Dashboard. Click on it and then click on Enable APIs and Services.
- Search for Google Drive and click on the result that says Google Drive API and then click on Enable.
- Now do step 4 again.
- Click Create Credentials > OAuth client ID.
- Choose application type as Desktop, name it whatever you want and click create.
- The newly created credential appears under "OAuth 2.0 Client IDs." Click the download button to the right of the newly-created OAuth 2.0 Client ID. We will get a client_secret.json file, we will need this for the next section.
- Use the colab notebook to easily obtain the token and the required code for the cloudflare proxy:
-
Run the cell of the respective method number you chose. Just press the circular play button beside the rectangular box.
-
Login with your google account. Copy the js code and copy the token string for later when we deploy the heroku backend, the token should look something like this:
{"token": "jhgdfgdhgfh", "refresh_token": "1//sdhgbfdhghd", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "hsdgfjhgfsd.apps.googleusercontent.com", "client_secret": "gfsdfsdgf", "scopes": ["https://www.googleapis.com/auth/drive"]}
- Go to https://dash.cloudflare.com/ log in or sign up.
- Open the Workers option.
- Create your sub-domain or continue if already done.
- Select the Free Plan. Click on Create a Worker. You can rename the workers at top of the page.
- In the
Script{}
box you will see some code, delete all that and paste the js code that you obtained in step 18 there.
- Hit the deploy button.
- Paste the token string in the token field.
- Copy your cloudflare worker url and paste it in the cf proxy url field.
- Hit deploy.
- Get the url of the heroku app you deployed. Add
/manifest.json
to the end. For example if my herokuapp url ishttps://stremiogdrive.herokuapp.com/
add/manifest.json
to the end to get:https://stremiogdrive.herokuapp.com/manifest.json
. Copy this url. - Go to https://staging.strem.io/ and log into your stremio account. Press the puzzle icon on the top right.
- On your left you will see a search box with the text "Search Addons", paste the url you got in step 1 in the search box. A prompt will open up, press install.
- Apps hosted on heroku sleeps after 30 mins of inactivity. So after 30 mins of inactivity the addon needs about 30 secs to start back up and then some time to fetch the results. If you use something like Kaffeine you can overcome this as Kaffeine pings your app every 30 mins. Downside is that you will spend extra dyno hours. Free dynos have about 550 hours of runtime per month which is about 22 days.
- Google api is not very fast so if you have a ton of results it might take 10 - 15 secs to load.
- Cloudflare workers is used as a proxy to stream files from google drive since it is really fast.
- I am an amateur and I did this to the best of my ability. If you find flaws feel free to post an issue.
For the sake of security please don't share your herokuapp url or your cloudflare workers proxy url. They can be used to get files from your drive.
- To the libDrive project for one part of the cloudflare js code.
- To alx-xlx go index repo for the other part of the cloudflare js code.