Embed stream files in mount for google drive (and others?)

This might be too specific to Plex users, but most of us know that for Google Drive and I believe ACD, both transcode video files. Google does this with their youtube service so Drive users can play the video in preview mode. Transcoding happens for different resolutions and for both FLV and MP4 containers. You can use services such as youtube-dl or getlinkdrive.com to extract the direct video links based on what resolution you want so you can download it.

I thought it would be a cool idea to pass an argument on rclone mount or maybe a command to show/download those files. If it were the mount, it could show the files and then use http to play them etc. I am talking off the cuff here, and this feature may not be pratical for the scope of this project, but it seems so wasteful that Plex uses so much CPU to transcode into MP4 when those files are already available and could be utilized. Thoughts?

I really wish Plex would bring back and enhance the .STRM file extension so we could all have URLs as library items. I went so far to hack into Plex’s database to see if I could figure out a way to get the transcoder to play them. But I am currently stuck. Ug!!!

1 Like

That is pretty much what the google drive interface does already to show google docs.

Can you search the API to see if there is an interface to find download links for transcoded resolutions?

API Docs

Looks like there is no official API, looks like you must actually parsed the shared page to get them.

I can’t work out which page it is parsing. Can you give directions?

ok so I have this working on public drive urls, you can use OAuth tokens and send the some headers to get it to work for any drive video (more on this later)

but if you use this url


it will return all the pre transcoded urls, I just split the string by https and then URL decode them, you can use the itag to find out the quality of the url

itag code reference http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
itag_dict = {1080: [‘137’, ‘37’, ‘46’], 720: [‘22’, ‘136’, ‘45’], 480: [‘135’, ‘59’, ‘44’, ‘35’], 360: [‘43’, ‘134’, ‘34’, ‘18’, ‘6’], 240: [‘133’, ‘5’, ‘36’], 144: [‘160’, ‘17’]}

looks like if you add these headers:

[(‘User-Agent’, ‘rclone’), (‘Authorization’ , ‘GoogleLogin auth=’+self.authorization.getToken(‘auth_writely’)), (‘GData-Version’ , ‘3.0’)]

let me know if I can provide any more assistance

Ooops sorry that just gets you the embedded video player, you then need to parse that page and look for the video tag

<video controls="" autoplay="" name="media" data-video="0"><source src="https://r7---sn-vgqsene7.c.docs.google.com/videoplayback?id=REDACTED" type="video/mp4"></video>

again sending the headers with the writely token to actually get the video, the file is the src= on the source tag

You can also look at a Kodi Plugin that accomplishes this. Basically its like what @MartinBowling said. Use http://docs.google.com/get_video_info?docid={google_drive_doc_id} To get the encoded video info. Then you have to decode it and parse it to get the specific urls for the quality versions. Also, in order to view/download the video files, you need to make sure the DRIVE_STREAM cookie is set. I will be tinkering with this next week and hopefully have a more complete picture.

Fancy working this up into a pull request?

my go skills are teh suck but I could try :slight_smile:

Honestly I’d pass on this feature, just my opinion but I put a lot of effort into obtaining quality releases from reputable internal release groups (esir, don, ebp, ctrlhd, tayto, primalhd, VietHD, SA89, NiP, etc…) point is I have been into video and quality video for sometime, and the transcoded streams on google look like complete butt.

I guess some people could use this feature and it would not be terrible on a small mobile screen but plex will pick the stream most compatible with your streaming device and most devices will perfer mp4 with aac audio which means your nice brand new 4k smart tv would have plex pick a crap quality video transcoded by google over a quality bluray rip.

if there is tons of time to devote to features like this awesome, but I think the google drive plex community more than anything else really needs a solid way to mount their files and use them without their google drive getting a 24hour ban. Not sayiing this should never be a feature, just… Priorities, let’s get google drive usable before we add features lol

Just my 2 cents

1 Like