Skip to content

Instantly share code, notes, and snippets.



Created May 7, 2021
What would you like to do?
Export Plex library titles via Node

I wanted to export all titles from the Plex library on my Mac and couldn't find a good tool.

This is a tiny, quick-and-dirty Node JS script, using node-plex-api.

It assumes you have node and npm installed.

Then just download this "script.js" and run:

npm install plex-api --save
node script.js your_plex_username your_plex_password > plex.txt
const PlexAPI = require("plex-api");
const client = new PlexAPI({hostname: "", username: process.argv[2], password: process.argv[3]})
client.query("/library/sections").then(function (data) {
data.MediaContainer.Directory.forEach(function(section) {
client.query("/library/sections/"+section.key+"/all").then(function (data2) {
console.log("# " + section.title)
data2.MediaContainer.Metadata.forEach(function(item) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment