Stremio addon for fetching videos from your google drive.

Overview

stremio-gdrive

image image

Instructions:

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 17 steps.

Method 1 starts from here

  1. Go to https://console.cloud.google.com/projectcreate
  2. Name the project whatever you want and click create.
  3. Next to "Google Cloud Platform," click the Down arrow image and select your project.
  4. At the top-left corner, click the hamburger menu icon: image Click APIs & Services > Credentials.
  5. Click Configure Consent Screen. The "OAuth consent screen" screen appears.
  6. Set user type to external and click create.
  7. Fill in the required details, you can give your own email as dev and support email. Click save and continue.
  8. For the scopes page leave it as it is and click save and continue.
  9. Now add yourself (your email id) as the test user by pressing add users. Click save and continue.
  10. Now on your left, under API & Services, you will see Dashboard. Click on it and then click on Enable APIs and Services.
  11. Search for Google Drive and click on the result that says Google Drive API and then click on Enable.
  12. Now do step 4 again.
  13. Click Create Credentials > OAuth client ID.
  14. Choose application type as Desktop, name it whatever you want and click create.
  15. 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.
  16. Now once again, at the top-left corner, click the hamburger menu icon: image Click APIs & Services > OAuth Consent Screen.
  17. Under Publishing Status you will see a button called PUBLISH APP, click on that and choose confrim.

Method 2 starts from here

  1. Use the colab notebook to easily obtain the token and the required code for the cloudflare proxy:

Open In Colab

  1. Run the cell of the respective method number you chose. Just press the circular play button beside the rectangular box.

  2. 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"]}

  1. Go to https://dash.cloudflare.com/ log in or sign up.
  2. Open the Workers option.
  3. Create your sub-domain or continue if already done.
  4. Select the Free Plan. Click on Create a Worker. You can rename the workers at top of the page.
  5. In the Script{} box you will see some code, delete all that and paste the js code that you obtained in step 18 there.

Deploying to heroku:

Deploy to Heroku

  1. Hit the deploy button.
  2. Paste the token string in the token field.
  3. Copy your cloudflare worker url and paste it in the cf proxy url field.
  4. Hit deploy.

Adding addon to Stremio:

  1. Get the url of the heroku app you deployed. Add /manifest.json to the end. For example if my herokuapp url is https://stremiogdrive.herokuapp.com/ add /manifest.json to the end to get: https://stremiogdrive.herokuapp.com/manifest.json. Copy this url.
  2. Go to https://staging.strem.io/ and log into your stremio account. Press the puzzle icon on the top right.
  3. 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.

How the addon works

The addon uses the drive api to search for video files in your drive (both your teamdrives and mydrive) kinda like using the google drive web search bar.

So after setting up the addon go and search for something on stremio. When you open a search result, stremio will ask the addon if it has the video for the search result. The addon searches for the video in your google drive and if it gets any result it will give it to stremio and stremio will display the results.

For example if I want to watch a movie, say its called Pirates of the Goolag, then:

  • I will open stremio and search for Pirates of the Goolag. If its on imdb then it should appear on the stremio search results (stremio fetches search results from imdb).
  • Open the search result for Pirates of the Goolag and stremio will ask the addon if it has a video stream for Pirates of the Goolag.
  • The addon searches in your Google Drive for Pirates of the Goolag and if its anywhere on your google drive, doesnt matter where as long as the video file has the name and year of the movie (for eg: Pirates of the Goolag 2016.mkv or Pirates.of.the.Goolag.2016.UHD.BluRay.x265.mkv), the addon will return the search results for Pirates of the Goolag.
  • Stremio will then display it as a video stream and all you have to do is tap on it and enjoy.

The addon searches for:

  • Movies by searching for Videos with their filename as the name of the movie and when it was released. Eg video filename: Pirates of the Goolag 2016.mkv

  • Series episodes by searching for Videos with their filename as the name of the series and which episode it was by a specifier. Supported specifiers are:

    • S01 E01
    • S1 E1
    • Season 1 Episode 1
    • 1x01

Issues / Limitations / Explanations

  • 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.

Comments
  • Stremio crashing when using Cloudflare proxy

    Stremio crashing when using Cloudflare proxy

    We meet again, ssnjr2002 😄

    When I use the proxy and after ~15 mins, Stremio becomes heavy and stutters a lot, and then it crashes at last. When this happens, my whole device becomes unresponsive until Stremio crashes and exits.

    • This happens on all my devices: Shield TV (2017) and Chromecast with Google TV.
    • The versions I tried: 1.4.5, 1.4.13, and 1.4.16.
    • The first 15 minutes (sometimes 30 minutes) play just fine, then the issue begins out of nowhere.
    • I tried all the HW Decoding settings (Auto, Disabled, Decoding, Full).
    • I have the cache set to 0. (But even other values don't help).
    • It's not an internet issue, as I'm able to play the same films without proxy without issues

    Given the last point, I don't know if it's truly the addon's issue or Stremio's, but note that this doesn't happen with other DL addons such as 123Movies... So I really don't know what's the issue.

    Edit: Forgot to mention that I tried large files and small files (30GB+ and ~5GB) And all of this with Arabic subtitles from the official addon "opensubtitles"

    opened by AlyafeiAli 14
  • Having trouble with buffering

    Having trouble with buffering

    Followed the Method one but having hard time playing 1-5Gb files anything less than a gb plays fine but anything more than that keep on buffering what could be the issue ?

    opened by krishne35 12
  • File name not passed to other players

    File name not passed to other players

    Hi,

    Whenever I play anything on other players, the addon passes the file's name as "load" instead of the actual name, always. I'm running the latest update of your code and Stremio, and I'm using a proxy... This issue is on both Android and Windows.

    Thank you for everything :)

    opened by AlyafeiAli 8
  • How to configure this!?

    How to configure this!?

    I understand this repo is very much in its infancy, but I think this part is an essential part of this. How am I supposed to config this add-on to scan my given folders! Screenshot_2021-05-08-01-40-25-12_4d38fce200f96aeac5e860e739312e76

    I'm not sure if Libdrive's config would exactly be working with it And if it would work please tell me or document it so that we can atleast test the thing. Thank you for reading through this.

    opened by hehenaice 8
  • Addon doesn't work with latest Stremio Android TV version

    Addon doesn't work with latest Stremio Android TV version

    Hi again, ssnjr2002!

    I hope you did well in your academics.

    If you're not informed, Stremio just released an Android TV version of the app and it looks really great.

    However, the gdrive addon is not returning any results in the app for some reason, I can see in the logs that it does find the links and tries to send them back to the Android TV app but nothing shows up in the app.

    10.1.52.7 - - [10/Aug/2022:07:40:27 +0000] "GET /stream/movie/tt5113044.json HTTP/1.1" 200 58784 "-" "-"

    Apparently, it doesn't recognize the Android TV client

    opened by AlyafeiAli 7
  • Some files not showing up in results

    Some files not showing up in results

    Hi, ssnjr2002,

    Once again, thank you so much for the amazing addon; it's a dream come true.

    While browsing Iron Man 3 (2013), I noticed that some REMUX-1080p files are not showing up in results, only one of them showed up for some reason. (More REMUX-2160p files showed up, however.)

    a) REMUX-1080p File that did show up: 1- Iron Man 3 (2013) 1080p Bluray REMUX x264 AVC [Hindi DDP5.1 ~ 640Kbps + English DTS-HDMA 7.1] Esub ~ FraMESToR.mkv

    b) REMUX-1080p Files that did not show up: 1- Iron.Man.3.2013.BluRay.1080p.DTS-HD.MA.7.1.AVC.REMUX-FraMeSToR.mkv 2- Iron.Man.3.2013.CEE.REPACK.BluRay.Remux.1080p.AVC.DTS-HD.MA.7.1-HiFi.mkv 3- iron.man.3.2013.1080p.bluray.REMUX.dts-hd.ma.7.1-publichd (Hi10p reencode).mkv

    c) REMUX-2160p files that did show up: 1- Iron Man 3 (2013) 2160p 4K UHD HDR10 Bluray REMUX x265 HEVC [Hindi DDP5.1 ~ 640Kbps + English DTS-HDMA 7.1] Esub ~ FGT2.mkv 2- Iron.Man.3.2013.UHD.2160p.BluRay.DTS-HDMA.7.1.HEVC.REMUX-FraMeSToR.mkv 3- Iron Man 3 2013 Remux-2160p.mkv

    d) REMUX-2160p files that did not show up: 1- Iron.Man.3.2013.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.7.1-FGT.mkv 2- Iron.Man.3.2013.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv 3- Iron.Man.3.2013.UHD.BluRay.2160p.DTS-HD.MA.7.1.HEVC.REMUX-FraMeSToR-4P.mkv 4- Iron.Man.3.2013.2160p.US.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT.mkv 5- Iron.Man.3.2013.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.7.1-FGT.mkv

    c2, d2, and d3 are the same file, but only c2 showed up... The only difference I can see is that c2 has the resolution in its name before the type, while the other two have the type after "UHD" and before "2160p".

    Of course, it is not a big deal, but I just wanted to let you know of the issue... Maybe you could find a solution 👍

    P.S.: They've finally updated the Android app, it can now stream without a proxy :)

    opened by AlyafeiAli 7
  • Sorting issue when there's a text before the movie's name

    Sorting issue when there's a text before the movie's name

    Hi again, ssnjr2002,

    I noticed that if there's a text before a movie's name, then it'll get pushed down like shown in the screenshot below. It goes like this: 2160p > 1080p > 720p > UnknownRes > 2160pWithTextBeofreMovie'sTitle > 1080pWithTextBeofreMovie'sTitle and so on...

    Not a big deal obviously, but still wanted to let you know. This is with the latest update btw.

    image

    opened by AlyafeiAli 5
  • Can I deploy it on a RPi instead of Heroku?

    Can I deploy it on a RPi instead of Heroku?

    Hi

    Thank you so much for this amazing addon, I really appreciate it!

    1- I have a Raspberry Pi that's running 24 hours, so I was wondering of there's a way to deploy your script on it instead of Heroku? If so, do you know how?

    2- Is Heroku being used to download from GDrive and upload to Stremio, or is it only being used to fetch the results and push the GDrive links?

    I'm assuming it's downloading and uploading, hence why I want to deploy on my own device to get faster speeds... If it's only fetching links, then Heroku is more than enough I guess and I won't need my RPi 😅

    BTW, when can we expect the Android update that allows the addon to run without a proxy?

    opened by AlyafeiAli 4
  • Heroku Deployment Issue.

    Heroku Deployment Issue.

    Item could not be created: We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy.

    guess we will have to find other place to deploy this?

    opened by vkazheng 2
  • Please add this  new feature.

    Please add this new feature.

    Hey could you please add a new feature for the search to also look into folders? Like I have a folder which has all the mkv files but it doesn't look into those folders. I'm using a shared drive btw.

    opened by MinorX 2
  • Question: services other than gdrive

    Question: services other than gdrive

    Since rclone is being used, can we use it to search something else like Mega? will changing type and the values we pass in cf_proxy.js with rclone config file be enough?

    opened by Amanse 1
  • Use streaming versions

    Use streaming versions

    Thank you for working on this project.

    I would like to know if the addon is also capable of intercepting the streaming variants that Google creates for each video on Drive. Encoding would no longer be necessary and it saves resources.

    opened by unvency 0
  • Error 400: invalid_request

    Error 400: invalid_request

    You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure.

    You can let the app developer know that this app doesn't comply with one or more Google validation rules.

    Request Details The content in this section has been provided by the app developer. This content has not been reviewed or verified by Google. If you’re the app developer, make sure that these request details comply with Google policies.

    redirect_uri: urn:ietf:wg:oauth:2.0:oob

    opened by DestroyerV 0
  • Telegram Bot using server api

    Telegram Bot using server api

    It would be nice to see to provide a bot interface using this plugin server api. we would be play stuff in any external player such as VLC, mxplayer etc. Perhaps a web-ui also?

    opened by alexpandain 0
  • Titles with dots or apostrophes not showing up

    Titles with dots or apostrophes not showing up

    Long time no see, ssnjr2002 I hope you're doing well

    I noticed that the addon doesn't show titles that have apostrophes or dots, like "Ron's Gone Wild (2021)" and "What If...? (2021)"

    a) Ron's Gone Wild (2021) 1- Rons.Gone.Wrong.2021.2160p.UHD.BluRay.REMUX.HDR.HEVC.Atmos-PiRaTeS.mkv 2- [MF] Rons.Gone.Wrong.2021.720p.BluRay.x265.10Bit-Pahe.mkv 3- Ron's.Gone.Wrong.2021.1080p.DSNP.ENG.WEB-DL.DDP5.1.HEVC.x265-Archie.mkv 4- Ron's Gone Wrong (2021) (2160p BluRay x265 10bit HDR Tigole).mkv None of these titles show up

    b) What If... ? (2021) 1- What If... (2021) - S01E01 - What If… Captain Cart… The First Avenger (1080p WEB-DL x265 Silence).mkv 2- What If…! - S01E01 - What If… Captain Carter Were The First Avenger WEBDL-1080p Proper.mkv 3- What.If.S01E01.iTA.ENG.HDR.2160p.WEB.HEVC.DDP5.1.h264-DENiED.mkv 4- What.If.S01E01.Captain.Carter.Were.The.First.Avenger.2160p.10bit.DSNP.WEB-DL.DDP5.1.HEVC-Vyndros.mkv Only b1 and b2 show up.

    I tried to solve this issue using the little experience I have with python, this is what I did to meta.py: https://github.com/theghost970/stremio-gdrive/blob/e7c8abd900f1ee4069cad54bbdb6cd73395f3a31/sgd/meta.py#L69-L77

    However, this solution is not perfect:

    • With this solution, it is able to show a1 and a2, but it's unable to show a3 and a4.
    • It is able to show everything in section b, but it introduced a new problem: Irrelevant results are showing up in case of "removing dots", those titles are:

    1- The Secrets She Keeps - S01E01 - Episode 1 WEBDL-1080p.mkv 2- Murder at the Cottage - The Search for Justice for Sophie - S01E01 - Episode 1 WEBDL-1080p.mkv 3- The Serpent (2021) - S01E01 - Episode 1 (1080p AMZN WEB-DL x265 Ghost).mkv 4- The Serpent - S01E01 - Episode 1 WEBDL-1080p.mkv

    It is not a big issue tbh, just wanted to let you know in case you were free :)

    opened by AlyafeiAli 5
Owner
null
Archivist - Easily archive 📦 Download folder to Google Drive ☁️

Archivist Script for archiving Download folder by uploading unmodified files to a Google Drive folder. Modified files will remain in the Download fold

Timing Liu 3 Sep 30, 2022
A Udemy downloader that can download DRM protected videos and non-DRM protected videos.

Udemy Downloader with DRM support NOTE This program is WIP, the code is provided as-is and i am not held resposible for any legal repercussions result

Puyodead1 468 Dec 29, 2022
Command-line program to download videos from YouTube.com and other video sites

youtube-dl - download videos from youtube.com or other video platforms

youtube-dl 116.4k Jan 7, 2023
FireDM is a python open source (Internet Download Manager) with multi-connections, high speed engine, it downloads general files and videos from youtube and tons of other streaming websites .

python open source (Internet Download Manager) with multi-connections, high speed engine, based on python, LibCurl, and youtube_dl https://github.com/firedm/FireDM

null 1.6k Apr 12, 2022
A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

pytube 7.9k Jan 2, 2023
Making the process of downloading youtube videos faster and more convinient.

Easy-YT Making the process of downloading youtube videos faster and more convinient. What can it do? This python script can be used to download youtub

Meynam 39 Nov 15, 2021
Jocomol 16 Dec 12, 2022
Youtube videos and channels scraper python wrapper!

YouTubeCrawle Wrapper for python Why This wrapper? This is wrapper is not limited to videos only it can scrape both channel and videos seperately ;D

Kei 16 Aug 8, 2022
Download videos and audio with a graphical interface in python

Youtube-Downloader Download videos and audio with a graphical interface in python Windows To run windows using Command Prompt python main.py linux To

null 2 Jan 7, 2022
This script fully automates of downloading tiktok videos, editing them,compiling them and finally uploading them to youtube.

This script fully automates of downloading tiktok videos, editing them,compiling them and finally uploading them to youtube. If you wanted to create a tiktok video compiilation youtubbe channel this script is here to help you :D

Supriyo Sarkar 32 Dec 16, 2022
A simple Python program which uses youtube-dl for downloading YouTube videos as mp3 files.

yt-mp3 converter This is a simple Python program which uses youtube-dl for downloading YouTube videos as mp3 files. This program is for you if you are

nostalgicnerdpenguin 1 Oct 24, 2021
Python software to download videos from Tiktok without rights

download-video-tiktok Python software to download videos from Tiktok without rights to install pip install requests Follow us telegram : https://t.me

muntazir halim 1 Oct 28, 2021
Download Youtube videos in mp4 format in a fast, easy, convenient way made with Python!

yt_downloader Download Youtube videos in mp4 format in a fast, easy, convenient way made with Python! Required Modules pytube os time colorama Errors

null 3 Jul 2, 2022
A script that downloads YouTube videos/audio

YouTube-Downloader A script that downloads YouTube videos/audio from youtube. Usage Download the script by executing the following in your terminal :

Debayan Sarkar 2 Jan 4, 2022
A CLI that searches and download Youtube videos in mp3 format.

A CLI that searches and download Youtube videos in mp3 format.

Finhawk 4 Jul 25, 2022
Youtube Downloader by PyTube é uma ferramenta simples com interface gráfica e escrito em python para baixar vídeos e playlists do youtube...

YouTube Downloader by PyTube O que é o YouTube Downloader by PyTube? YouTube Downloader by PyTube é um software simples para baixar vídeos no YouTube

Elizeu Barbosa Abreu 5 Jul 30, 2022
Um projeto modesto para baixar vídeos do youtube usando tkinter como gui

Youtube Downloader Um projeto modesto para baixar vídeos do youtube usando tkinter como gui Instalação dos requirements: python3 setup.py ou python se

Sunlyx 2 Nov 25, 2021
🔥 A Bot To Telegram For Download High Qulity Videos & Songs From Youtube

?? A Bot To Telegram For Download High Qulity Videos & Songs From Youtube ?? Fast And Free Bot No Need To Pay ✅ By SL-Alpha-X-Team ⚡

Official Alpha-X-Team Account 7 Aug 31, 2022
A simple Python +3.x script to download videos from Facebook.

Facebook Video Downloader A simple Python +3.x script to download videos from Facebook posts

Kerolos Atef Saber 1 Dec 3, 2021