aboutsummaryrefslogtreecommitdiff
path: root/src/server/ApiManagers/UtilManager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/ApiManagers/UtilManager.ts')
-rw-r--r--src/server/ApiManagers/UtilManager.ts24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/server/ApiManagers/UtilManager.ts b/src/server/ApiManagers/UtilManager.ts
index dbf274e93..4cb57a4e7 100644
--- a/src/server/ApiManagers/UtilManager.ts
+++ b/src/server/ApiManagers/UtilManager.ts
@@ -1,10 +1,9 @@
import ApiManager, { Registration } from "./ApiManager";
import { Method } from "../RouteManager";
import { exec } from 'child_process';
-import { command_line } from "../ActionUtilities";
import RouteSubscriber from "../RouteSubscriber";
import { red } from "colors";
-import { main } from "../../scraping/buxton/node_scraper";
+import executeImport from "../../scraping/buxton/final/BuxtonImporter";
export default class UtilManager extends ApiManager {
@@ -43,26 +42,7 @@ export default class UtilManager extends ApiManager {
register({
method: Method.GET,
subscription: "/buxton",
- secureHandler: async ({ res }) => {
- const cwd = './src/scraping/buxton';
-
- const onResolved = (stdout: string) => { console.log(stdout); res.redirect("/"); };
- const onRejected = (err: any) => { console.error(err.message); res.send(err); };
- const tryPython3 = (reason: any) => {
- console.log("Initial scraper failed for the following reason:");
- console.log(red(reason.Error));
- console.log("Falling back to python3...");
- return command_line('python3 scraper.py', cwd).then(onResolved, onRejected);
- };
-
- return command_line('python scraper.py', cwd).then(onResolved, tryPython3);
- },
- });
-
- register({
- method: Method.GET,
- subscription: "/newBuxton",
- secureHandler: async ({ res }) => res.send(await main())
+ secureHandler: async ({ res }) => res.send(await executeImport())
});
register({