python-plexapi icon indicating copy to clipboard operation
python-plexapi copied to clipboard

Add support for Plex Profile Watch History and Ratings

Open simonc56 opened this issue 1 year ago • 1 comments

What is your feature request?

With the Activity feature added to Plex, user can see its own Watched History and Ratings.

  • https://support.plex.tv/articles/profile/
  • https://app.plex.tv/desktop/#!/profile

It would be great to be able to leverage this feature with Plexapi and have commands to get last n watched items or last n rated items from Plex account.

Additional Context

The Plex web app seems to request the server like this (example for last 50 watched items) :

POST https://community.plex.tv/api

{"query":".........",
"variables":
{  "first":50,
   "uuid":"......",
   "skipUserState":true},
   "operationName":"GetWatchHistoryHub"}

Response :

{
  "data": {
    "user": {
      "watchHistory": {
        "nodes": [
          {
            "item": {
              "id": "63750e3b3624e83e9fed57b6",
              "images": {
                "coverArt": "https://image.tmdb.org/t/p/original/9G9mMPLJBYiTU22iZrmWHDJljln.jpg",
                "coverPoster": "https://image.tmdb.org/t/p/original/24aqFyotK7hoC5noSSr80g4Dngp.jpg",
                "thumbnail": "https://image.tmdb.org/t/p/original/2DVeyl9SwZMuZf09bdJaRqYDsWa.jpg",
                "art": "https://image.tmdb.org/t/p/original/1tZE6Kj4KYCsWGv78bfhRS8cWB.jpg"
              },
              "title": "Grand Expectations",
              "key": "/library/metadata/63750e3b3624e83e9fed57b6",
              "type": "MOVIE",
              "index": 0,
              "publicPagesURL": "https://watch.plex.tv/movie/grand-expectations",
              "parent": null,
              "grandparent": null,
              "publishedAt": "2023-03-22T00:00:00.000Z",
              "leafCount": null,
              "year": 2023,
              "originallyAvailableAt": "2023-03-22",
              "childCount": null
            },
            "date": "2023-12-27T12:43:30.000Z",

simonc56 avatar Dec 27 '23 18:12 simonc56

+1 for this addition. At the moment I use some custom Python alongside this library to extract this code but it is a messy integration.

ZacWarham avatar May 21 '25 06:05 ZacWarham