Getting an app.plex.tv URL from python PlexAPI?

I have written a python script that uses PlexAPI to scrape the TV shows that I watch and builds a webpage to present all that information. It properly displays thumbnail images and such, making calls like “show.url(show.grandparentThumb)”.

One thing I’d like to add is having the thumbnail be clickable and link to the app.plex.tv page for the show. But so far, I have been unable to find a method that generates that link. Does one exist?

I was hoping “plex.url(show.grandparentKey, True)” did that, but it is just a link to the XML data…

The URL I’m looking for is of the form: http ://app.plex.tv/desktop#!/server/1234abcdef1234/details?key=%2Flibrary%2Fmetadata%2F12345

Take a look at Tautulli. It might have something you can borrow, or at least point you in the right direction.

Tautulli can send a newsletter listing recently added media. The e-mail is HTML formatted. If you click on the movie/show thumbnail it takes you to the Plex Web page for that movie/show.

You can also do that from a Library page. Click on a library to list contents. Click on desired media. It takes you to a second page (shows media info, viewing history, etc). From that page you can click on the thumbnail and end up at the Plex Web page for that movie/show.

That is a big codebase to dig through! I think I’ve found the basic area where it sends those emails, but that leads down another rabbit hole. It looks like it is using pmsconnect class to generate that information, which makes sense. However I was running into the issue that I’m not quite sure what I’m looking for…

In the URL https://app.plex.tv/desktop#!/server/1234abc1234/details?key=%2Flibrary%2Fmetadata%2F12345, I needed to figure out what the “1234abc1234” actually was… Exploring the PlexAPI fields, I found that this is the “machineIdentifier” field. So I just built the URL with that identifier and the key, and it works!

Now my final roadblock amusingly is the should-be-simple task of finding out my username from the server. Strangely, all of the fields on PlexServer object seem to give the server owner’s information rather than the logged in user’s… Seems a bit of a security issue that the myPlexUsername attribute returns the owner’s email address…

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