Git Product home page Git Product logo

plextube's Introduction

PlexTube

PlexTube is designed to run on your Plex server. When asked, it will download videos from YouTube and loads them into Plex.

It's designed to be easily integrated into iOS using the "Workflow" app.

Why?

YouTube's iOS app is garbage. It eschews the standard way to play videos in iOS, which means you lose a bunch of handy features like background playing, and (on iPad) picture-in-picture. It doesn't buffer very much, and it certainly doesn't allow downloading for offline viewing.

Presumably, they do all this to allow them to show you ads, both before and in the middle of videos. Presumably, they continue to do this even if you subscribe to YouTube Red, their ad-free service. Not that I would know, because it's not even available in my country.

Other apps like Jonas Gessner's amazing ProTube attempted to remedy this. But rather than take those improvements into their own app — or negotiate with these app developers to find a way to add ads, or even just limit use of third-party apps to Red subscribers — they elected to just shut down third party YouTube clients via legal threats.

PlexTube is my way of continuing to avoid using the YouTube iOS app. It's not the most convenient way to watch YouTube, and my motivations may be petty as heck, and they may come for PlexTube next — but damned if I'm going to use their shitty app.

Dependencies

Erlang and Elixir

PlexTube is written in Elixir, which is a language running on top of Erlang. You'll need both of these to make it work.

If you follow the Elixir install instructions, you should end up with both of these. Most of the automatic (i.e. packaged) installs will automatically install Erlang for you. The manual install methods include instructions on installing Erlang.

If you're installing the Debian/Ubuntu packages, make sure to include erlang-dev (the Erlang headers) and erlang-tools (some development tools). These are needed by PlexTube's dependencies.

PlexTube was written in Elixir 1.5 running on Erlang 20. You can try running it under older versions, but there's no guarantees it'll work.

youtube-dl

In order to download videos, you'll need youtube-dl. PlexTube is pretty useless without it.

Make sure it's somewhere in your $PATH. If you choose to deploy as another user, make sure it's in their $PATH. (You may also want to make it writable by that user so you can schedule a youtube-dl --update now and then.)

ffmpeg

PlexTube will tell youtube-dl to download the best video and audio quality that YouTube has available. These generally involve fetching two different formats, and then combining the video from one with the audio from the other.

Merging these two formats together requires an encoder like ffmpeg. If you edit the source and change the youtube-dl arguments, you can get away without it … but who doesn't want the best quality results?

YouTube agent for Plex

You'll almost certainly want the YouTube metadata agent for Plex. It'll fill in the proper title, author, and description for each video.

To install, you'll need to rename the extracted directory to YouTube-Agent.bundle and put it into your Plex server's plugin directory. See these instructions for details.

Be sure to enable it in your server preferences — it's under Server → Agents → Films → YouTube — and set your library type to the "Films" with the "YouTube" agent selected. You'll also probably want to enable the "Set YouTube usernames as director in metadata" feature.

Installation

Installing

  1. Ensure dependencies are installed; see above.
  2. Run mix deps.get to fetch the libraries PlexTube needs.
  3. Run mix plex.token <your plex username> <your plex password> to authenticate with Plex and get a token.
  4. Edit config/plextube.example.exs, add your Plex token and library path, and save it as config/plextube.exs.

Now, you have two options on how to run PlexTube

Running on the spot

For beginners, I recommend just running mix plextube.server. This will launch the server right here and now, ready to accept requests. (To exit the server, press control-C twice.)

By default, it listens on localhost (127.0.0.1), port 3232. If you want to open this up to the world, you'll need to edit your config/plextube.exs and set bind_to_ip to 0.0.0.0. (You may also have to set up port forwarding so the world can reach you.)

Deploying

The above method should be enough to get you going. However, if you're an experienced Elixir developer and/or sysadmin, and you want more flexibility, you can try deploying instead.

This is a more complex topic, and is covered in a separate document.

iOS integration

So how do you easily get videos into PlexTube? The "Workflow" app for iOS holds the answer.

Included in the ios directory are workflows that can be used to send YouTube video URLs to PlexTube:

  • Watch in PlexTube: Downloads a video and launches Plex.
    • Will wait until the video is downloaded, but Plex may take a moment to add the video, and you may need to back out and refresh.
    • May time out when downloading longer videos, or on slow connections.
  • Queue in PlexTube: Downloads a video in the background.
    • Only takes as long as it needs to process the video ID and get ready to download.
    • It's not really "queuing" anything, since all videos are downloaded simultaneously. But "send to" is too generic and "cast to" means something different, so, "queue" it is.
  • I'm hoping to eventually make a third action that will launch a webpage with progress bars, and then take you to Plex when done.

To get them into Workflow, just navigate here with your iOS device and download the files. You may also be able to load them other ways, such as copying them to iCloud Drive, emailing them to yourself, etc.

Once loaded into Workflow, edit the URL to point it to your Plex server, and edit the secret if needed.

OH GOD WHAT IS ALL THIS

If all of the above is way too complicated for you, then consider installing YouTubeTV instead. Instead of downloading videos, it adds a YouTube channel to your Plex server.

(Heck, you should install it either way — I use YouTubeTV for my subscriptions, and PlexTube for other videos.)

Once installed, you can sign in as your YouTube account, view your subscriptions / history / etc., and enjoy all the benefits of Plex (except offline viewing). However, I believe only the server owner can use this — so while other users won't see your history etc., you also can't easily share videos with them.

Legal stuff

Copyright © 2017, Adrian Irving-Beer.

PlexTube is released under the Apache 2 License and is provided with no warranty. Remember, you're deploying a web service that runs commands on your precious Plex server. I make every effort to write secure code, but you're still using PlexTube at your own risk.

plextube's People

Contributors

wisq avatar

Stargazers

Omar Assadi avatar Wei Cheng avatar  avatar Michael L avatar Pedro Siqueira avatar Pimeko avatar Ted avatar  avatar Gumer Coronel avatar  avatar Sam Bostock avatar Joe Block avatar  avatar Daniel Hoherd avatar Mark Carey avatar Michael Warkentin avatar

Watchers

James Cloos avatar  avatar

Forkers

plexhaxx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.