Updated YouTube Plugin

I was a little disappointed by the lack of features in the YouTube plugin so have made some additions. The changes are as follows:



For subscriptions, instead of the current list which only shows videos for channel subscriptions and activity for user subscriptions, this version shows a submenu for each subscription, giving you the option to view either list and also to unsubscribe. I’ve also set the list to show alphabetically by channel name to make it easier to find a specific channel.



The feed menus now shows the author of videos as well as the title and also the number of views.



I’ve added a channel menu allowing you to subscribe to a channel.



I’ve added the ability to like, dislike, view comments, add a comment and reply to a comment.



I’ve also added a link to the list of a channel’s videos from a video.



I haven’t tried to do any localisation on any display strings I’ve added, but that should be fairly simple to add. The features may also benefit from additional preferences (e.g., in terms of showing the author in video titles, showing number of views, etc).



Overall, I think these changes turn the existing plugin into a fairly full YouTube experience.



If you want to try this out, then add the following two lines to the Info.plist file first or else the changes will get automatically overwritten by the standard version again:



PlexPluginDevMode

1



Enjoy!



YouTube.zip (9.58 KB)

I will give it a shot.



Any chance you could fork this so it can be added to the main plugin?

Nice work. I shall put this to the test. I am a recent converter from XBMC to Plex and in all honesty the XBMC version of YouTube provides a better user experience. The following features would make youtube for plex complete:


A YouTube suggests section which recommends videos based on browsing history…

When you search videos it would be nice to cache previous search criteria for an easy search and allow deletion of some of the searches using the C button.

Ability to sort search results by date added, rating, views etc…

Ability to view subscription channel playlists.


This would make the youtube experience align with xbmc for me so would really appreciate work on this.


Thank you

Tried this but it will not even load for me.  So I did a little editing of thge file and after replacing the AddPrefixHandler with the one from git, the plug-in loads but then fails when trying to load videos into the menu.

Plug-in would not load so I changed this:

Plugin.AddPrefixHandler('/video/youtube', MainMenu, TITLE, ICON, ART)

To This:

Plugin.AddPrefixHandler('/video/youtube', MainMenu, 'YouTube')

And the plugin loaded.

I'm very new to python so I'm probably missing a lot here.  Does the version you posted only run on a particular version of Plex, perhaps?  I'd sure like the features you added without having to code them myself...

The PMS I'm running is Version 0.9.7.22 running on Ubuntu.

Thanks

I've not experienced the problem with the plugin not starting at all so can't comment on that.

I did, however, notice that the plugin was broken by a recent update in the Plex Media Server and haven't had time before now to look into it.  (I also really hate Python, so try not to look at the code more than I have to anyway!)

Well, the log files were complaining that there is no "Submenu" in the preferences and, indeed, there are numerous calls to Prefs['Submenu'] in the code (I have no idea why).  My code relies on this always being true, so I've just updated the code accordingly and it now works again for me.

I'm enclosing the changed file.  I would love to add extra functionality as suggested by leb2nv, but I really didn't want to have to mess with the Python code any more than necessary to do what I have already done.  Perhaps those who maintain this plugin would be willing to take the additions in this version and include them into their version and add some extra features?  Otherwise, if someone else feels up to hacking the code, I'm sure others would be more than grateful...

Mark

YouTube.zip (9.54 KB)

Thanks plex_mb!  The plugin is working well for me now.  I'll be looking to add subscription playlist capability and tweak the menus a bit, but for the most part, this gives me what I need.

Thanks again!

Starting with the version provided by plex_mb, I made some additional enhancements to the YouTube plugin. 

Major Changes include:
1. Added playlists.  These are useful when videos are broken up into several smaller videos or when "collecting" videos from diverse channels.  The main menu contains the playlists you create.  My subscriptions and Channels menus contain the playlists of the channel.
2. Eliminated the my account menu. Opting instead, to bring those features right into the main menu.
3. Added a long video search feature.  This is an option I use more frequently than not.  There are some good full length programs out there if you can find them. 
4. Created custom icons for many features.  I was very tired of looking at the YouTube logo for everywhere.  While my icons are not stunners, I find them much more pleasing to look at.  Just copy them to the Resources directory of the plugin if you want to use them.

In addition several other changes and bug fixes were made:
-Added the upload date for subscription upload activity menu
-Fixed bugs in parsing that prevented subscription activity from appearing
-Added the length of the video to several menus
-Removed code to exclude videos with App$Control which was preventing some videos from being listed and played.
-Upgraded video image thumbs to HQ

-Several features were removed from the main menu.

Couple of other things...
-This has not been tested on Windows.  I run PMS on Ubuntu and play videos using a Roku.
-I've never coded in Python before and I'm new to Plex so you will likely find things that could be done better.
-There is more that can be done: It needs a Play All feature for playlists, it needs dates on more activities, and needs the video duration displayed on other menus.  I also have lots of ideas for allowing customization thru the settings menu but have not had time to dig in to that.
-I've not created a branch in git either. I'll try to get around to that.

BTW, if you have not entered your youtube user id and password into the preferences, you will not see main menu features that require an account such as  subscriptions, favorites, watch later, etc...

Great work, there, gb01!  Especially with the new icons and the playlists.

A few points...

The following sections are not available in your update:

"My Videos"

"My Activity"

"New Subscription Videos"

Any chance of adding them back in?  These are essential for those of us with videos posted...

Number of items in the activity list.  I ended up setting this quite low (at 8) because of the time that it takes to load the meta data.  Rather than put this at 50, can it either be lower, or else added to the preferences?

Ratings in the activity stream: Google changed something recently so now you don't seem to be able to tell if someone liked or disliked.  I changed that to just stick with saying "rated" in my local copy (yours has a question mark showing).  Not much can be done about this, unfortunately.

Finally, Google also changed how comments are listed in the activity stream.  I had added something locally which I hadn't uploaded to account for this.  I'm attaching the latest version I'm using with this decoding in which you can use to get comments back in the activity stream.

Anyway, many thanks for progressing this!  It's definitely going in the right direction!

Mark

YouTube-comments.zip (9.66 KB)

Good point on those removed features, since I don't upload videos myself, those were not features I focused on.  Easy to add back. Although I don't recall the new subscription videos feature - I'll look for it, seems like something I'd use as well.

I agree that the activity feed takes a long time to load, that is one item that would be nice to have in the preferences. Easy to set a different default until that can be done.

Ratings have changed and I don't see any documentation in the API about it.  I want to look at it again but maybe this just becomes "liked" rather than rated.

I'll look at the comments stuff as well.  Appreciate the feedback.

Gary

Added the three features back and reduced the number of activities.  Not sure I'm happy with the order of the main menu items but at least all the features are there.  Also added your code related to comments but I'm still not seeing them in the feed.  Can you highlight the changes you made to be sure I have them all? 

Just missing the definition of RE_COMMENT_ID_ALT at the top.  Also, comment out/remove the line following "#Above added for Mark" or it will override the alt comment parse.

One other thing, the subscription elements bring back an ID instead of a name.  Look for the use of "UserInfo" in my code (and its definition).  This ensures that you get the channel name rather than the ID.

I agree that the main menu could be neater.  Perhaps move those items that would be more particular to people with their own content into a submenu (so, "My Videos", "My Playlists").

The "New Subscription Videos" didn't make it into the version you posted.  Did you manage to get that back in? :-)

The "New Subscription Videos" didn't make it into the version you posted.  Did you manage to get that back in? :-)

He put it in as 'New Videos' under the 'My Subscriptions' folder. Makes sense, and works brilliantly.

Thanks to both you, plex_mb, and gb01. This version of the plugin is great; it's much better than the native YouTube app on an AppleTV, and much better than the native Plex app. I hope the Plex people integrate it. Have you tried offering them the code?

Here is another installment of the youtube plug in - probably my last. 

Updates since the last version:
Enhancements/Changes:
-Added video recommendations feature to main menu
-Added channel image to the My Account thumb in the main menu
-Updated some icons
-Moved Favorites and Watch Later playlists from the main menu to the playlists menu
-Moved the My Activity and My Videos from the main menu to the My Account menu
-Added the channel's image to the video sub menu (in place of the default icon)
-Suppressed the display of the Channel thumb in the video sub menu when coming directly from the -subscription menu - Prevents some un-intended potential menu looping
-Removed the "Previous" thumb in long lists - Didn't seem necessary and created a menu loop (of sorts) when used
-Added ability to add videos to your Watch Later playlist to the video sub-menu
-Refactored activity parsing to reduce code size and clean up display

Bug Fixes:
-Fixed bugs in parsing that prevented subscription activity from appearing
-Fixed bug that caused channel ID (rather than channel name) to be displayed in the activity list
-Fixed bug in subscribe code when user name had a space in it

Known Bugs:
-Breadcrumbs can get corrupted after visiting the channel menu and watching a video

Hope you enjoy it.  I have created a repository on github. garybucher / YouTube.bundle  No idea if they'll accept it when I request a pull but I will do that soon.  Appreciate any additional testing you may want to do.

youtube.zip (452 KB)

Hmm - I can't make it work anylonger - not sure if youtube changed something?
 
E.g. this one 
http://gdata.youtube.com/feeds/api/users/default?alt=json
fails with.
 
User authentication required. Error 401"
Any ideas?
 
EDIT:
E.g. this fails in plex - but not in my browser?
http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?time=today&alt=json&start-index=1&max-results=50
 

2013-08-01 01:26:52,250 (ed8) :  ERROR (networking:219) - Error opening URL 'http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?time=today&alt=json&start-index=1&max-results=50'

My PMS is running on Windows XP

EDIT2:

Today it worked better for some reason - but still stuff wasn't good since I got "NoLinkedYouTubeAccount" errors. After googling about it I realize I had to create a channel for my account - then things got A LOT better  :)

Thanks gb01,

Awesome, finally a descent youtube plugin.

Cheers

Is anyone still supporting the YT Plugin? If so, could you please look into my post about this being broken and advise??

Tx, M

See: https://forums.plex.tv/topic/109004-youtube-channel-this-channel-is-not-responding/

All features has been added to github as fork for the original youtube plugin

https://github.com/plexinc-plugins/YouTube.bundle/pull/26

Due to some changes in Youtube API some functions are not working like

Commenting

Subscribe

but other functions are working fine (better than nothing!)

I'm not expert in python but please keep updating your code (very nice).

I would suggest to use github to better control changes by the team.

Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.