Skip to content

Commit

Permalink
feat: runned crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
zain-ul-din-zafar committed Feb 12, 2024
1 parent 1a147e4 commit e699891
Show file tree
Hide file tree
Showing 238 changed files with 57 additions and 14 deletions.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BBA (Hons) Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BBA (Hons) Sec B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS Chemistry Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS DFCS Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS DFCS Sec B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS DFCS Sec C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS English Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS IR1 Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS Mass Comm Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS URDU Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BS Zoology Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSAF Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec E.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec F.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec G.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec H.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec I.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec J.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec K.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec L.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec M.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSCS Sec N.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSIT Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSIT Sec B.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSSE Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSSE Sec B.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSSE Sec C.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 BSSE Sec D.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MBA Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MPhil English Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MPhil IR1 Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MSBA Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MSCS Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MSDS Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 MSIT Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 Mphil URDU Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 Pearson_BTEC Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 PhD Chemistry Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 PhD Urdu Sec A.png
Binary file modified dist/1st Semester Fall-2023 - Fall-2023 WCCI Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BBA (Hons) Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BS DFCS Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BS English Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSAF Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSCS Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSCS Sec B.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSCS Sec C.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSCS Sec D.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSIT Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 BSSE Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 MBA Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 MPhil IR2 Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 MSCS Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 MSDS Sec A.png
Binary file modified dist/2nd Semester Fall-2023 - Spring-2023 MSIT Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BBA (Hons) Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BBA (Hons) Sec B.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BBA (Hons) Sec C.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS Chemistry Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS DFCS Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS DFCS Sec B.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS DFCS Sec C.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS English Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS IR3 Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS Mass Comm Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BS Physics Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSAF Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec B.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec C.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec D.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec E.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec F.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec G.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec H.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec I.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSCS Sec J.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSIT Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSIT Sec B.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSSE Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSSE Sec B.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSSE Sec C.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 BSSE Sec D.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 MBA Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 MSCS Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 MSDS Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 MSIT Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 Pearson_BTEC Sec A.png
Binary file modified dist/3rd Semester Fall-2023 - Fall-2022 WCCI Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BBA (Hons) Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BS DFCS Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSAF Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSCS Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSCS Sec B.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSCS Sec C.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSCS Sec D.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSIT Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSSE Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 BSSE Sec B.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 MSCS Sec A.png
Binary file modified dist/4th Semester Fall-2023 - Spring-2022 MSIT Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BBA (Hons) Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BBA (Hons) Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BBA (Hons) Sec C.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS Chemistry Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS DFCS Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS DFCS Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS English Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS English Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS IR5 Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS Mass Comm Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS Mass Comm Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS Physics Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BS URDU Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSAF Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec C.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec D.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec E.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec F.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec G.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec H.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSCS Sec I.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSIT Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSIT Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSSE Sec A.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSSE Sec B.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSSE Sec C.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSSE Sec D.png
Binary file modified dist/5th Semester Fall-2023 - Fall-2021 BSSE Sec E.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BBA (Hons) Sec A.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BS English Sec A.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BSCS Sec A.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BSCS Sec B.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BSIT Sec A.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BSSE Sec A.png
Binary file modified dist/6th Semester Fall-2023 - Spring-2021 BSSE Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BBA (Hons) Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BBA (Hons) Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BBA (Hons) Sec C.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS Chemistry Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS Chemistry Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS DFCS Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS English Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS English Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS IR7 Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS Mass Comm Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS Physics Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BS Zoology Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSAF Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec C.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec D.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec E.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec F.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec G.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec H.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec I.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSCS Sec J.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSIT Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSIT Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSSE Sec A.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSSE Sec B.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSSE Sec C.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSSE Sec D.png
Binary file modified dist/7th Semester Fall-2023 - Fall-2020 BSSE Sec E.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BBA (Hons) Sec A.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BS DFCS Sec A.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BS English Sec A.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BSCS Sec A.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BSCS Sec B.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BSIT Sec A.png
Binary file modified dist/8th Semester Fall-2023 - Spring-2020 BSSE Sec A.png
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import dotenv from 'dotenv';
dotenv.config();

import { intro, outro, spinner, select } from '@clack/prompts';
import { delay, replaceAll, sleep, clearFolder } from './lib/util';
import { delay, replaceAll, sleep, clearFolder, gitStageChange } from './lib/util';
import { scrapeMetaData } from './scrapper/meta_data';

import { write_metadata, writeTimetableData, calculateTeachersTimetable, calculatePastTimetableInputOptions, calculateRoomsTimeTable } from './lib/firebase';
Expand Down Expand Up @@ -65,8 +65,6 @@ else if(option as CLI_OPTIONS == CLI_OPTIONS.rooms_timetable)
if ((option as CLI_OPTIONS) != CLI_OPTIONS.crawler)
process.exit(0)

// removes all screen shots
clearFolder("./dist")

/// INTRO

Expand All @@ -87,6 +85,10 @@ if (hasCache) {
const file_buffer = readFileSync(CACHE_FILE_NAME, 'utf-8');
metaData = JSON.parse(file_buffer);
} else {
// removes all screen shots
clearFolder("./dist")
gitStageChange("./dist", `🚮 removed: all screen-shots at ${new Date().toDateString()}`)

metaData = await scrapeMetaData();
s.start('Writing MetaData to firebase');
await write_metadata(metaData);
Expand Down
13 changes: 13 additions & 0 deletions src/lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { readdirSync, unlinkSync } from "fs"
import { join } from "path"
import { exec } from "child_process"

/**
Stops the main thread for given time
Expand Down Expand Up @@ -56,3 +57,15 @@ export function clearFolder(folderPath: string) {
}


/**
* commits file to git
* @param filePath
* @param commitMsg
*/
export function gitStageChange(
filePath: string,
commitMsg: string
) {
exec(`git add ${filePath}`)
exec(`git commit -m "${commitMsg}"`)
}
50 changes: 39 additions & 11 deletions src/scrapper/timetable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///

import { Page } from 'puppeteer';
import { replaceAll, delay } from "../lib/util"
import { replaceAll, delay, gitStageChange } from "../lib/util"

interface Payload {
semester: string;
Expand All @@ -14,7 +14,7 @@ interface Payload {
export async function scrapTimetable(payload: Payload, page: Page): Promise<any> {


await page.setViewport({width: 1400, height: 720 });
await page.setViewport({width: 1920, height: 1080 });

await page.waitForSelector('#semester');
const dropDown = await page.$('#semester');
Expand Down Expand Up @@ -70,11 +70,31 @@ export async function scrapTimetable(payload: Payload, page: Page): Promise<any>
await delay(1)



const timetableData = await page.evaluate(() => {
Array.from(document.querySelectorAll(".footer-copyright")).forEach(ele => ele.style.display = 'none')

// add updated at label
(()=>{
const ele = document.createElement('h3') as HTMLDivElement
const parent = document.querySelector(".panel > div") as HTMLDivElement

parent.setAttribute('style', `
padding: 2rem;
display: flex;
align-items: center;
justify-content: space-between;
`);

ele.setAttribute('style', `font-size: 24px;`);

(parent.firstChild as HTMLDivElement).setAttribute ('style' , "color: white");
ele.textContent = `Updated At: ${new Date().toDateString()}`
parent.appendChild(ele)
})()

Array.from(document.querySelectorAll(".footer-copyright")).forEach(ele => (ele as HTMLDivElement).style.display = 'none')
const tbody = Array.from(document.querySelectorAll('tr'));
tbody.splice(0, 1);

return tbody
.map((ele) => {
// th & td
Expand Down Expand Up @@ -108,12 +128,20 @@ export async function scrapTimetable(payload: Payload, page: Page): Promise<any>
}, {});
});

// take screen shot
await page.screenshot({
"type": "png",
"path": `./dist/${replaceAll(`${payload.semester} ${payload.program} ${payload.section}`,`/`,'-')}.png`,
"fullPage": true
console.log("done so far");

await page.waitForSelector(".panel");

const ssFileName = `${replaceAll(`${payload.semester} ${payload.program} ${payload.section}`,`/`,'-')}.png`;
const ssFilePath = `./dist/${ssFileName}`;

await (await page.$(".panel"))?.screenshot({
"type": 'png',
"path": ssFilePath
})


// add file to git
gitStageChange(ssFilePath, `📷 feat: capture ${ssFileName}`)

return timetableData;
}
}

0 comments on commit e699891

Please sign in to comment.