fix: add missing auth token in Plex request

This commit is contained in:
gauthier-th
2024-06-25 15:22:45 +02:00
committed by Gauthier
parent 99443d2796
commit bebbd690b4
2 changed files with 6 additions and 4 deletions

View File

@@ -18,8 +18,8 @@ interface ExternalAPIOptions {
class ExternalAPI {
private baseUrl: string;
private params: Record<string, string>;
private defaultHeaders: { [key: string]: string };
protected params: Record<string, string>;
protected defaultHeaders: { [key: string]: string };
private cache?: NodeCache;
constructor(

View File

@@ -259,13 +259,15 @@ class PlexTvAPI extends ExternalAPI {
items: PlexWatchlistItem[];
}> {
try {
// const response = await this.get<WatchlistResponse>(
const params = new URLSearchParams({
'X-Plex-Container-Start': offset.toString(),
'X-Plex-Container-Size': size.toString(),
});
const response = await fetch(
`https://metadata.provider.plex.tv/library/sections/watchlist/all?${params.toString()}`
`https://metadata.provider.plex.tv/library/sections/watchlist/all?${params.toString()}`,
{
headers: this.defaultHeaders,
}
);
const data = (await response.json()) as WatchlistResponse;