This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
const XLSX = require('xlsx');
|
||||
const fs = require("fs");
|
||||
const parseAbsence = require('./utils/parseAbsence');
|
||||
const parseTeachers = require('./utils/parseTeachers');
|
||||
import XLSX from "xlsx";
|
||||
import fs from "fs";
|
||||
import parseAbsence from "./utils/parseAbsence.js";
|
||||
import parseTeachers from "./utils/parseTeachers.js";
|
||||
|
||||
async function parseThisShit(downloadedFilePath) {
|
||||
export default async function parseThisShit(downloadedFilePath) {
|
||||
const workbook = XLSX.readFile(downloadedFilePath);
|
||||
const sheetNames = workbook.SheetNames;
|
||||
|
||||
@@ -138,6 +138,4 @@ async function parseThisShit(downloadedFilePath) {
|
||||
fs.writeFileSync('db/current.json', JSON.stringify(data));
|
||||
}
|
||||
|
||||
module.exports = parseThisShit;
|
||||
|
||||
// parseThisShit("downloads/table.xlsx");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const parseThisShit = require('./parse');
|
||||
import puppeteer from 'puppeteer';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import parseThisShit from './parse.js';
|
||||
|
||||
const EMAIL = process.env.EMAIL;
|
||||
const PASSWORD = process.env.PASSWORD;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function parseAbsence(str, teacherMap) {
|
||||
export default function parseAbsence(str, teacherMap) {
|
||||
str = str.trim().replace(/\s+/g, " ");
|
||||
|
||||
const result = {
|
||||
@@ -40,5 +40,3 @@ function parseAbsence(str, teacherMap) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = parseAbsence;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
const cheerio = require("cheerio");
|
||||
const fetch = require("node-fetch");
|
||||
import * as cheerio from "cheerio";
|
||||
|
||||
globalThis.File = class File {};
|
||||
|
||||
async function parseTeachers() {
|
||||
export default async function parseTeachers() {
|
||||
const url = "https://spsejecna.cz/ucitel";
|
||||
const response = await fetch(url);
|
||||
const data = await response.text(); // fetch needs .text() to get HTML
|
||||
@@ -24,5 +23,3 @@ async function parseTeachers() {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
module.exports = parseTeachers;
|
||||
|
||||
Reference in New Issue
Block a user