YouTube-Agent.bundle icon indicating copy to clipboard operation
YouTube-Agent.bundle copied to clipboard

The agent just stopped scanning a couple of days ago.

Open mcfarlandaaron1 opened this issue 1 year ago • 19 comments

The Youtube agent for some reason just stopped scanning in new files correctly on Monday April 3rd 2023. I have tried rebooting, reinstalling the agent bundle, creating a new library, getting a new API from the Google Developer Console, and nothing is fixing the problem. Everything is scanning in with the title of 'O:\Youtube[Name of Channel] since mid Monday. I try to match the video file in Plex and it never brings the metadata back and names the file correctly. I am not sure if this is something with me or Youtube changed something that day that broke this agent. I can provide any logs you need to assist, but I am not sure what to look at to determine the reason for the reason this agent broke. I will note I am using yt-dlp to download the youtube files and I provided the config file of the settings I have set for the youtube downloads for yt-dlp. Thank you. com.plexapp.agents.youtube.log

config.txt

mcfarlandaaron1 avatar Apr 06 '23 11:04 mcfarlandaaron1

2023-04-06 04:59:14,220 (a374) :  DEBUG (networking:143) - Requesting 'https://i.ytimg.com/vi_webp/cZ0wXDFtk3w/maxresdefault.webp'
2023-04-06 04:59:14,223 (a374) :  CRITICAL (core:574) - Exception in the update function of agent named 'YouTubeMovie', called with guid 'com.plexapp.agents.youtube://youtube|cZ0wXDFtk3w|Mel Robbins - [UCk2U-Oqn7RXf-ydPqfSxG5g]?lang=xn' (most recent call last):
  File "C:\Program Files\Plex\Plex Media Server\Resources\Plug-ins-ba892e5ce\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1093, in _update
    agent.update(obj, media, lang, **kwargs)
  File "M:\Plex\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 557, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  True)
  File "M:\Plex\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 423, in Update
    metadata.posters [thumb_channel] = Proxy.Media(HTTP.Request(thumb_channel).content, sort_order=1 if Prefs['media_poster_source']=='Channel' else 2)

Not sure webp is a supported file format to be honest, line 423 should reject this format, so i suggest to try this:

            if thumb_channel is not None and not thumb_channel.endswith('.webp'):
              metadata.posters [thumb_channel] = Proxy.Media(HTTP.Request(thumb_channel).content, sort_order=1 if Prefs['media_poster_source']=='Channel' else 2)

If it works, please let me know and i will include into the master code

ZeroQI avatar Apr 06 '23 16:04 ZeroQI

@ZeroQI just so I am clear of what you wanted me to try, is this where this should be placed in the init.py file? Thank you for the quick response also.

Screenshot 2023-04-06 181727

mcfarlandaaron1 avatar Apr 07 '23 00:04 mcfarlandaaron1

Yes, but add 2 spaces more in 423 and 424

ZeroQI avatar Apr 07 '23 00:04 ZeroQI

@ZeroQI It seems to be working better adding the items you suggested, but I am still having some issues with the file names and I am not sure if that is on my end or what the issue is. If you look at the two screenshots, one shows the metadata pulled in correctly, but the name of the video is the file path. I did add the latest log to the item below this.

Screenshot 2023-04-07 110315 Screenshot 2023-04-07 110346

mcfarlandaaron1 avatar Apr 07 '23 17:04 mcfarlandaaron1

I did create a brand new plex library with a folder from youtube download directory, with the above images.

com.plexapp.agents.youtube.log

mcfarlandaaron1 avatar Apr 07 '23 17:04 mcfarlandaaron1

It appears the 1.32.0.6865 update broke this agent from working correctly as downgrading back to 1.31.3.6868 fixed the problem. https://www.reddit.com/r/PleX/comments/12c5se2/did_anyones_zeroqis_youtube_plex_agent_stop/jfocisz/

mcfarlandaaron1 avatar Apr 10 '23 10:04 mcfarlandaaron1

I am running into the same issue and it seems like this person is too.

All of the logs I have and have seen from other people have a SSLError. One of the undocumented changes Plex made with 1.32.X is they dropped OpenSSL 1.1.1 support, so now it's OpenSSL 3+ only. It really sucks because Plex uses Python 2.7 which doesn't have OpenSSL 3. I've asked about any plans to include python3 but worried that this might be the end of plugins.

TChilderhose avatar Apr 18 '23 12:04 TChilderhose

@TChilderhose I have found a workaround. Sadly, none of this will work for media already download before these steps. I documented them on the Plex forums. https://forums.plex.tv/t/rel-youtube-metadata-agent/44574/359?u=amcfarla

mcfarlandaaron1 avatar Apr 18 '23 12:04 mcfarlandaaron1

I was actually doing something very similar before I started to using this agent. For my use case with my family I really wanted the season and show structure that TV Shows provided vs the all-in-one/movie approach that Other Videos provide.

But I bookmarked it in case there is no other approach, thanks.

TChilderhose avatar Apr 18 '23 13:04 TChilderhose

They have no plans on Python 3. You might be able to get around the cert issues, but having it use an OpenSSL library that the Python version doesnt support is going to cause a lot of other issues with https. Other than sticking with PMS 1.31.X I dont really have a great solution for the plugin unfortunately

TChilderhose avatar Apr 19 '23 11:04 TChilderhose

I just saw that other thread...here's hoping "we're looking into it, no ETA" isn't quite the blowoff it sounds like.

Tripletap007 avatar Apr 21 '23 15:04 Tripletap007

Ended up having some time today and worked on a fix. I posted it in the thread so hopefully they can just use it or at least give them a good starting point.

Been running it on 1.32.1.6983 with 0 issues so far.

TChilderhose avatar Apr 23 '23 17:04 TChilderhose

Really appreciate your time and energy!

Tripletap007 avatar Apr 23 '23 18:04 Tripletap007

Plex Media Server 1.32.1.6999 fixes the issue

TChilderhose avatar Apr 25 '23 18:04 TChilderhose

@TChilderhose It does? Did you have to do anything special to fix the problem or does it just start scraping correctly?

mcfarlandaaron1 avatar Apr 25 '23 18:04 mcfarlandaaron1

I did need to do the plex dance for existing things that were missing data, but new stuff worked.

TChilderhose avatar Apr 25 '23 18:04 TChilderhose

I did need to do the plex dance for existing things that were missing data, but new stuff worked.

That is great to hear. Let me give it a try and see if it fixes it for me. I know a couple on this Plex forum https://forums.plex.tv/t/rel-youtube-metadata-agent/44574/370 will be happy to hear this.

mcfarlandaaron1 avatar Apr 25 '23 18:04 mcfarlandaaron1

@TChilderhose just tested it with a few folders from my YouTube directory and it is scanning them in correctly and showing the metadata like it should.

mcfarlandaaron1 avatar Apr 25 '23 18:04 mcfarlandaaron1

Any updates? Because I think it looks like I have some simulair issues For me its error opening the googleapi's url and looks like its started failing about the same time Redacted my API key because as a secondary test I did register my own api key as it recommended

""" ERROR (networking:197) - Error opening URL 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=5NpbU7I55Zw&key=REDACTEDAPIKEY' 2023-05-29 20:10:50,787 (7f723cfc5b38) : INFO (init:509) - json_video_details - Could not retrieve data from YouTube for: 5NpbU7I55Zw """

tanja84dk avatar May 30 '23 13:05 tanja84dk