Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

[REL] YouTube Metadata Agent

sander1sander1 Channel Developer/AdminMembers, Plex Pass, Plex Ninja Posts: 3,629 Plex Ninja

This is a Metadata Agent for downloaded YouTube videos. It works by looking up metadata on YouTube using the YouTube video id. It is important to have this id in the filename, otherwise this agent can't do the lookup. You can change the way the id is found in your filenames (through the Agent's preferences). This value is a regular expression and requires 1 named group called id.

The default value is: \[(?P<id>.{11})\]

This will find the YouTube id in names, like for example:
Person Of Interest Soundtrack - John Reese Themes (Compilation) [OR5EnqdnwK0].mp4

Download and source

Download: https://github.com/sander1/YouTube-Agent.bundle/archive/master.zip
Source: https://github.com/sander1/YouTube-Agent.bundle

Installation

See the How do I manually install a channel? support article.

«1

Comments

  • zombianzombian Members, Plex Pass Posts: 343 Plex Pass
    Dude thank you so much. I was just asking my wife how I was going sort all these incredible YouTube shorts in Plex without having to do a bunch of manual editing. You have hopefully saved the day. I'll be sure to give this a try once I get home.

    A lie can get half way across the world before the truth even gets its shoes on.

  • snickerssnickers Members, Plex Pass Posts: 593 Plex Pass

    excellent! thank you!

    PMS: Ubuntu Server, i7 4770T, 120GB SSD, 5x5 3TB HDD, DigitalDevices DVB-C

    PMC: 4x Mac OS - 3x iOS - 2x Android (buggy) - 2x Ubuntu (not working) - 4x Samsung-SmartTV (not working) - 2x RasPlex

  • PCB_AUPCB_AU Members, Plex Pass Posts: 1 Plex Pass
    edited May 2014

    Sorry to be one of those guys who revives an old(ish) thread...

    This is fantastic for single YouTube videos, but I'd like to "upgrade it" so it can be used for entire playlists as well. In this situation it would obviously make more sense to have the videos within a TV Shows library rather than a Movies library.

    AFAIK YouTube's API doesn't seem to provide a way of knowing whether a video belongs to a playlist according to it's ID. What might prove useful though is if the Playlist's ID is included in the video's parent folder name.

    To clarify:

    /"Playlist Name" [Playlist ID]

         /"Video Name" [Video ID]

    I'll look into tackling this one myself, although I've never written anything for Plex before or anything that uses YouTube's API (so I could be entirely wrong about getting information about a playlist from a video ID).

    Does anyone else have any thoughts?

    Cheers

  • te5s3raktte5s3rakt Members, Plex Pass Posts: 138 Plex Pass

    This'd be great... 

    I'm actually trying to figure out a way to subscribe to YouTube channels and/or playlists in a rss podcast catcher, in a way that'll either download the associated metadata and store it locally for plex to read from, or have a plex agent grab it online based on the video id in the file name...

    Not sure how this is going to be done yet... was about to post about it... just an idea i had the other day, because I spat it at the fact you need to re add all the videos you want in a queue when "casting" to a chrome cast... you can cast a playlist, but can't save the current queue as a playlist to re listen to later... figured if i could rss podcast a playlist of mine on youtube to collect them, the catcher will download, and plex can be my goto for music videos as well as movies/tv...

  • s1mplemans1mpleman Members, Plex Pass Posts: 468 Plex Pass
    te5s3rakt wrote on April 8 2015, 10:20 AM: »

    This'd be great... 

    I'm actually trying to figure out a way to subscribe to YouTube channels and/or playlists in a rss podcast catcher, in a way that'll either download the associated metadata and store it locally for plex to read from, or have a plex agent grab it online based on the video id in the file name...

    Not sure how this is going to be done yet... was about to post about it... just an idea i had the other day, because I spat it at the fact you need to re add all the videos you want in a queue when "casting" to a chrome cast... you can cast a playlist, but can't save the current queue as a playlist to re listen to later... figured if i could rss podcast a playlist of mine on youtube to collect them, the catcher will download, and plex can be my goto for music videos as well as movies/tv...

    You can use youtube-dl and script it to automatically download new episode added to a playlist :)

  • ytandoganytandogan Members Posts: 9 ✭✭

    This is fantastic. Thanks a lot Castle Keeper.

    May I suggest the following;

    1. Channel name and / or Playlist name can be used to group the videos in Library. 

            ex: TEDTalks | TED-ed

            Currently, even if the videos are stored under specific folders Plex Library shows all videos in a flat view.

    2. Category tag in youtube can be used as Genre in Plex.

    Since the post is old I am hoping there is time and demand for developing this agent a little more.

    Thanks in advance.

  • s1mplemans1mpleman Members, Plex Pass Posts: 468 Plex Pass
    edited May 2015
    ytandogan wrote on April 21 2015, 6:39 PM: »

    This is fantastic. Thanks a lot Castle Keeper.

    May I suggest the following;

    1. Channel name and / or Playlist name can be used to group the videos in Library. 

            ex: TEDTalks | TED-ed

            Currently, even if the videos are stored under specific folders Plex Library shows all videos in a flat view.

    2. Category tag in youtube can be used as Genre in Plex.

    Since the post is old I am hoping there is time and demand for developing this agent a little more.

    Thanks in advance.

    I'm having a play with this tonight and the Plex Extended Personal Scanner... it's a little better than the default scanners for picking up dated ordered items that might make youtube videos easier to organise. 

    If my thinking is correct I should be able to have the following. 

    Channel Name/ Year/ File name 

    **EDIT**

    Wouldn't work because this is a movie scanner and the Plex Extended Personal Scanner is for TV Shows... No biggy. 

    Is anyone still working on this? Mines managed to just pull http://youtube.com/devicesupportfor the video titles. Nothing else. 

  • CraqueheadCraquehead Members, Plex Pass Posts: 41 Plex Pass
    edited May 2015
    s1mpleman wrote on May 7 2015, 1:54 PM: »

    Is anyone still working on this? Mines managed to just pull http://youtube.com/devicesupportfor the video titles. Nothing else. 

    The problem is that Youtube stopped supporting the v2 API that this agent relies on.

     I've managed to get the agent working with the v3 API, but it requires an API key. (anyone can get one, but the one I'm using is tied to my personal google account)

     Unless the original author re-writes the agent to scrape the page instead of using the API, not sure there's a way to get around the requirement for an API key tied to a person.

    --Update--

    I've submitted a pull request to the original author with my changes. It requires signing up for an API key and entering it through the agent preferences. 

  • s1mplemans1mpleman Members, Plex Pass Posts: 468 Plex Pass
    Craquehead wrote on May 8 2015, 7:25 PM: »

    The problem is that Youtube stopped supporting the v2 API that this agent relies on.

     I've managed to get the agent working with the v3 API, but it requires an API key. (anyone can get one, but the one I'm using is tied to my personal google account)

     Unless the original author re-writes the agent to scrape the page instead of using the API, not sure there's a way to get around the requirement for an API key tied to a person.

    --Update--

    I've submitted a pull request to the original author with my changes. It requires signing up for an API key and entering it through the agent preferences. 

    Hopefully they are added :)

  • JeromeJerome Members, Plex Pass Posts: 2 Plex Pass
    Craquehead wrote on May 8 2015, 7:25 PM: »

    The problem is that Youtube stopped supporting the v2 API that this agent relies on.

     I've managed to get the agent working with the v3 API, but it requires an API key. (anyone can get one, but the one I'm using is tied to my personal google account)

     Unless the original author re-writes the agent to scrape the page instead of using the API, not sure there's a way to get around the requirement for an API key tied to a person.

    --Update--

    I've submitted a pull request to the original author with my changes. It requires signing up for an API key and entering it through the agent preferences. 

    Your updates work perfectly Craquehead. Many, many thanks! :wub: 

    For anyone else looking to fix the YouTube agent using Craquehead's updates, here are the instructions:

    1. Go to Craquehead's GitHub repository and download a zip of the latest code
    2. Shut down your Plex server
    3. Open your Plex plugins directory (you can right click on the Plex icon in the taskbar on windows) and extract the zip file there.
    4. Start your Plex server
    5. Get a YouTube API v3 key
      1. Log into your Google account, go to the Developer's Console, and click "Create Project" and call it something like "Plex YouTube Agent" so it's easy to figure out what it is later
      2. Click "APIs & auth" on the left
      3. Under "YouTube APIs", click "YouTube Data API", then "Enable API"
      4. Click on "Credentials" on the left under "APIS & auth"
      5. Under "Public API access" click Create new Key
      6. Select Server key and finish the creation process
      7. On the right you should see a section called "Key for server applications", where you should copy the long API key
    6. Open your Plex media manager and click on settings, then server, then agents
    7. Click on "YouTube" under the Movies agents tab
    8. Click the settings icon next to the YouTube agent line item and enter your API key in the second field
    9. To update any mis-tagged YouTube videos, open their details screen in Plex, select the more icon "..." and click "unmatch"
  • sander1sander1 Channel Developer/Admin Members, Plex Pass, Plex Ninja Posts: 3,629 Plex Ninja

    The agent has been updated to work without the (v2) API.

  • TijderTijder Members, Plex Pass Posts: 70 Plex Pass
    edited May 2015
    sander1 wrote on May 14 2015, 8:47 PM: »

    The agent has been updated to work without the (v2) API.

    Thanks for the update :).

  • chyron8472chyron8472 Members, Plex Pass Posts: 222 Plex Pass

    Is this only for Movies and not TV Shows?

    I'm downloading a Let's Play and want to use this agent to populate each episode's metadata.

  • ZeroQIZeroQI Members Posts: 1,170 ✭✭✭

    Absolute Series Scanner (ASS): Seasons+Absolute mode series scanner managing subdirectories and AniDB type specials,with a logging off all files (skipped on top of root folder, then sorted one line per file with regex used and info, all series sorted alphabetically) and one with the filelist to reproduce the library on my end with dummy files. It also add all files and recognise specials pretty accurately.

    http AniDB Metadata Agent (HAMA): Some good info there, will have to re-write it at some point... Data folders are kinda mandatory... Huge libraries can fetch 10gb in space. If you have no poster but other metadata is showing, create "Plug-in Support/Data/com.plexapp.agents.hama/DataItems" agent folders as indicated in the readme on GitHub

    Impressed by the agent recognition rate? Consider donating few euros through Paypal: Absolute Series Scanner + HTTP AniDB Metadata Agent. (List of all donators: Niegen, Vorador, Fratal, T. Mayville,  A. Estremera, KJKingJ. Thanks guys)

  • onegearonegear Members, Plex Pass Posts: 3 Plex Pass

    Does this still work? I've installed the plugin and selected the Youtube agent in Plex but it doesn't seem to add any metadata.

    I set up a test movie library with the scanner set to plex movie scanner, the agent to Youtube and the default regular expression (because I've got no idea how they work).

    Youtube-dl is set up to name downloads as [channel name] - [upload date] - [video name] - [video ID].[ext] so the id is always at the end of the filename before the extension. :-?

  • sander1sander1 Channel Developer/Admin Members, Plex Pass, Plex Ninja Posts: 3,629 Plex Ninja
    edited September 2016

    @onegear said:
    Does this still work? I've installed the plugin and selected the Youtube agent in Plex but it doesn't seem to add any metadata.

    I set up a test movie library with the scanner set to plex movie scanner, the agent to Youtube and the default regular expression (because I've got no idea how they work).

    Youtube-dl is set up to name downloads as [channel name] - [upload date] - [video name] - [video ID].[ext] so the id is always at the end of the filename before the extension. :-?

    The default regular expression requires the video id to be in square brackets, it doesn't matter where in the filename the id is. You have to change the regular expression if your filenames are different.

    Example of a filename that works with the default regular expression: Person Of Interest Soundtrack - John Reese Themes (Compilation) [OR5EnqdnwK0].mp4

  • onegearonegear Members, Plex Pass Posts: 3 Plex Pass

    Ahh ok thanks, I completely missed the brackets in your original post! I've tweaked my youtube-dl settings to add them in.

    Is there any way to get it to populate the summary with the Youtube video description?

  • sander1sander1 Channel Developer/Admin Members, Plex Pass, Plex Ninja Posts: 3,629 Plex Ninja

    @onegear said:
    Is there any way to get it to populate the summary with the Youtube video description?

    It should already do this :) I'll check this later tonight, maybe something is broken.

  • sander1sander1 Channel Developer/Admin Members, Plex Pass, Plex Ninja Posts: 3,629 Plex Ninja

    @sander1 said:

    @onegear said:
    Is there any way to get it to populate the summary with the Youtube video description?

    It should already do this :) I'll check this later tonight, maybe something is broken.

    Some things have changed a bit on YouTube's side. I'm working on an update!

  • sander1sander1 Channel Developer/Admin Members, Plex Pass, Plex Ninja Posts: 3,629 Plex Ninja

    @sander1 said:

    @sander1 said:

    @onegear said:
    Is there any way to get it to populate the summary with the Youtube video description?

    It should already do this :) I'll check this later tonight, maybe something is broken.

    Some things have changed a bit on YouTube's side. I'm working on an update!

    An updated agent is available. See the first post for download locations.

«1
Sign In or Register to comment.