podcastsuite
Version:
A set of utilities to work with Podcasts
83 lines (82 loc) • 2.38 kB
TypeScript
import { DBInstance } from "./DB";
import Format, { IEpisode } from "./Format";
export interface IPodcastSuiteConfig {
proxy?: IProxy;
podcasts?: string[];
fresh?: number;
fetchEngine?: Function;
shouldInit?: boolean;
}
export interface IProxy {
"https:": string;
"http:": string;
}
export interface IPodcast {
title?: string;
description?: string;
url: string;
link?: string;
author?: string;
category?: string;
explicit?: string;
summary?: string;
copyright?: string;
language?: string;
image?: string;
items?: IEpisode[];
created: number;
length?: number;
}
export interface IRSS {
rss: {
[key: string]: any;
};
}
export declare const PROXY: IProxy;
declare class PodcastSuite {
static proxyURL(url: URL, proxy: IProxy): string;
static parser(content: string): Promise<IRSS>;
static createDatabase(table: string, database: string): DBInstance;
static fetch(podcastURL: URL, config?: {
proxy?: IProxy;
signal?: any;
fetchEngine?: any;
}): Promise<IPodcast>;
static fetchContent(contentURL: URL, config?: {
proxy?: IProxy;
signal?: any;
progress?: () => any;
fetchEngine?: any;
}): any;
static fetchSize(url: URL, config?: {
proxy?: IProxy;
signal?: any;
fetchEngine?: any;
}): Promise<number>;
private static isFresh;
private static parserEngine;
static format: typeof Format;
getPodcast(key: string, config?: {
latest?: boolean;
save?: boolean;
fresh?: number;
}): Promise<IPodcast>;
getContent(contentURL: URL, config?: {
refresh?: boolean;
}): Promise<any>;
getLibrary(): Promise<IDBValidKey[]>;
canUpdateLibrary(): Promise<any[][]>;
mapLibraryEntries(fn: (value: IPodcast) => any): Promise<IPodcast[]>;
mapLibrary(fn: (value: any) => any): Promise<PromiseSettledResult<any>[]>;
private requestURL;
private refreshURL;
private init;
protected static db: DBInstance;
protected static contentDB: DBInstance;
private proxy;
private fresh;
private fetchEngine;
ready: Promise<Boolean>;
constructor(config?: IPodcastSuiteConfig);
}
export default PodcastSuite;