mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-13 15:17:25 -05:00
add episodes/podcasts to spotify, fix soundcloud bugs
This commit is contained in:
12
src/index.ts
12
src/index.ts
@@ -1,4 +1,4 @@
|
||||
import { ItemType, GetByUrlResponse, SearchResults, Streamer, StreamerWithLogin } from './types.js'
|
||||
import { ItemType, GetByUrlResponse, SearchResults, Streamer, StreamerWithLogin, StreamerAccount } from './types.js'
|
||||
|
||||
interface LucidaOptions {
|
||||
modules: { [key: string]: Streamer | StreamerWithLogin }
|
||||
@@ -38,6 +38,16 @@ class Lucida {
|
||||
const moduleNames = Object.keys(this.modules)
|
||||
return Object.fromEntries(results.map((e, i) => [moduleNames[i], e]))
|
||||
}
|
||||
async checkAccounts(): Promise<{ [key: string]: StreamerAccount }> {
|
||||
const results = await Promise.all(
|
||||
Object.values(this.modules).map(async (e) => {
|
||||
if (e.getAccountInfo) return (await e.getAccountInfo())
|
||||
else return {valid: false}
|
||||
})
|
||||
)
|
||||
const moduleNames = Object.keys(this.modules)
|
||||
return Object.fromEntries(results.map((e, i) => [moduleNames[i], e]))
|
||||
}
|
||||
async getTypeFromUrl(url: string): Promise<ItemType> {
|
||||
const urlObj = new URL(url)
|
||||
for (const i in this.modules) {
|
||||
|
||||
Reference in New Issue
Block a user