Socket
Book a DemoInstallSign in
Socket

@jjdenhertog/plex-music-search

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jjdenhertog/plex-music-search

Library to find tracks in your Plex Library

1.0.23
latest
npmnpm
Version published
Weekly downloads
58
11.54%
Maintainers
1
Weekly downloads
 
Created
Source

The plex-music-search library can be used to search for tracks in a Plex music library, building on the functionality of music-search with Plex-specific configurations.

Table of Contents

Installation

Install the plex-music-search library with npm:

npm install @jjdenhertog/plex-music-search

Usage

The library provides a straightforward API to search tracks in your Plex library. To get started, you’ll need the URI and token for your Plex server.

import PlexMusicSearch from '@jjdenhertog/plex-music-search';

const searchItems = [
    { id: "track1", title: "Shape of You", album: "Divide", artists: ["Ed Sheeran"] },
    // More items...
];

const plexMusicSearch = new PlexMusicSearch({
    uri: "https://your-plex-server-url",
    token: "your-plex-auth-token",
});

// Search for multiple tracks
const searchResult = await plexMusicSearch.search(searchItems);
console.log(searchResult);

What is with the ID while searching?

You might notice that the search query must contain an ID

const searchItems = [
    { id: "track1", title: "Shape of You", album: "Divide", artists: ["Ed Sheeran"] },
    // More items...
];

Most of the times when you're searching for a track you are doing it to match one library with the other. For example matching Spotify with Plex. The result after searching will contain the original search query including the id and the results. The results are all the tracks matching with the search query. With this approach you can trace back the results more easily.

If you do not need the id for this purpose, you can simply leave it empty:

{ id: "", title: "Shape of You", album: "Divide", artists: ["Ed Sheeran"] }

Configuration Options

The plex-music-search library supports several configuration options to customize the search behavior. Here’s a quick look at the main options:

  • uri: URL of the Plex server.
  • token: Plex authentication token.

Example:

const plexMusicSearch = new PlexMusicSearch({
    uri: "https://your-plex-server-url",
    token: "your-plex-auth-token"
});

Getting Plex URI and Token

To use plex-music-search, you’ll need your Plex server's URI and a token for authentication:

  • URI: This is the base URL of your Plex server. You can usually find this in your Plex server settings, or by accessing Plex Web and copying the URL from your browser.

  • Token: The Plex token is required to authenticate API requests. To find your token:

    • Open Plex Web and log in.
    • Right-click on the page and select "Inspect" or "View Page Source."
    • Look for the token in the source code (often found after the term "X-Plex-Token").

Faster searching

The default approach searches quite thoroughly through your library but as a result it can be time-consuming. By default it uses three search approaches. By limiting to only one search approach you will decrease the time searching tremendously.

const searchItems = [
    { id: "1234", title: "Shape of You", album: "Divide", artists: ["Ed Sheeran"] },
    // More items...
];

const plexMusicSearch = new PlexMusicSearch({
    uri: "https://your-plex-server-url",
    token: "your-plex-auth-token",
    searchApproaches: [{ id: 'fast', filtered: true, trimmed: false}]
});

// Search for multiple tracks
const searchResult = await plexMusicSearch.search(searchItems);

Support This Open-Source Project ❤️

If you appreciate my work, consider starring this repository or making a donation to support ongoing development. Your support means the world to me—thank you!

Buy Me a Coffee

Are you a developer and have some free time on your hand? It would be great if you can help me maintain and improve this library.

Keywords

plex

FAQs

Package last updated on 04 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.