It didn’t quite start out with my friends and family members asking me what movies or genre of movies I watch but more with a slab of XML content thrown at me when I mistyped my Plex URL in the browser. The difference can easily be noticed, even today, on Plex version
I run my Plex server in a static local IP,
192.168.1.111:32400, and I came across this absolutely ridiculous slab of
XML content when I forgot to append
:32400 because the actual Plex Web URL format would be
The slab of XML content is provided below, or you could head to your Plex URL and remove the
/web parameter to check it out yourself.
I am unsure why Plex haven’t implemented the Export option for a library of any sort yet but it could be that I am unaware of its existence. Out of all these
statistics piqued my interest therefore I started browsing through them and noticed
library node consisted of three different sub-nodes,
onDeck. Out of these 3 nodes,
sections node holds what we need.
sections node gave me more nodes, basically contains an identification for my libraries, notice the attribute
If we navigate to
192.168.1.111:32400/library/sections/2, we are thrown with more slab of XML, sorting/categorized options by the looks of it. The title attribute in these nodes makes it clear that we need the
Directory node with attribute
key="all" is all we need to create a list of movies that we have in our library. Verify it by navigating to that directory/node,
192.168.1.111:32400/library/sections/2/all and viola, there we have it, dumps and dumps of items we have in the library with
Now we are left with a lots of XML entries, we could share this with our friends but they would probably discard it because finding the title of each entry is quite painful as it varies in length and not always in the same position as the previous entries.
I made use of Python because it has a built-in module for XML parsing called
xml.etree.ElementTree which is enough for us to parse our Plex Library’s sections and create a formatted list for us to share with others. The script is quite short as we used a built-in module provided by Python, available in both
.. and there we have it, we used
urllib module to get the
plexlist.xml file from the provided URL, initialized and read through each
Video node in our XML and retrieved our movie title and saved it to
PlexList.txt for proper identification of files. I could definitely write and extend the crucial and informative contents that we wish to extract from our XML but for now, movie titles should do the job.
That’s about it, easy as pie!
Poster Image credits to VENNGAGE!