Files
dancing-summarizer/main.ts
2025-05-05 16:37:54 +02:00

62 lines
1.3 KiB
TypeScript

import { Mwn } from 'npm:mwn'
import process from "node:process";
async function getWorkshopVideos(bot: Mwn): Promise<string[]> {
const response = await bot.request({
action: 'query',
list: 'allimages',
aiprefix: 'WCS ', // Search prefix
ailimit: 'max', // Maximum number of results
});
if (response.query === undefined) {
throw new Error("Did not receive response to file query")
}
// Extract and print the file titles
return response.query.allimages.map(image => image.title);
console.log('Files starting with "ABC ":', files);
const file_content = await bot.read(files[0])
console.dir(file_content.revisions[0].content)
console.dir(await bot.parseTitle(files[0]))
}
interface VideoDescription {
teachers: string[]
location: string
level: string
date: string
patterns: string
notes: string
}
function parseSummary(description: string): VideoDescription {
}
async function main() {
const bot = new Mwn({
apiUrl: 'https://dancing.thasky.one/api.php',
username: process.env.BOTNAME,
password: process.env.BOTPW,
userAgent: 'mwn bot',
});
try {
await bot.login();
const relevantFiles = await getWorkshopVideos(bot)
} catch (error) {
console.error('Error:', error);
} finally {
await bot.logout();
}
}
main();