File size: 756 Bytes
f6f0c71 8e7c043 acf17aa 8e7c043 f6f0c71 acf17aa f6f0c71 acf17aa 8e7c043 f6f0c71 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import { scribdDownloader } from "./service/ScribdDownloader.js"
import { slideshareDownloader } from "./service/SlideshareDownloader.js"
import * as scribdRegex from "./const/ScribdRegex.js"
import * as slideshareRegex from "./const/SlideshareRegex.js"
class App {
constructor() {
if (!App.instance) {
App.instance = this
}
return App.instance
}
async execute(url, flag) {
if (url.match(scribdRegex.DOMAIN)) {
await scribdDownloader.execute(url, flag)
} else if (url.match(slideshareRegex.DOMAIN)) {
await slideshareDownloader.execute(url, flag)
} else {
throw new Error(`Unsupported URL: ${url}`)
}
}
}
export const app = new App() |