From d1321d6f7673c5dfca02fbbfe738b5f81f7b0fb8 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Wed, 15 May 2024 16:19:17 -0700 Subject: [PATCH] =?UTF-8?q?style:=20=F0=9F=8E=A8=20code=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../build.mjs | 0 .../package.json | 0 .../src/index.ts | 9 +++------ 3 files changed, 3 insertions(+), 6 deletions(-) rename services/{departments-scraper => departments-terms-scraper}/build.mjs (100%) rename services/{departments-scraper => departments-terms-scraper}/package.json (100%) rename services/{departments-scraper => departments-terms-scraper}/src/index.ts (82%) diff --git a/services/departments-scraper/build.mjs b/services/departments-terms-scraper/build.mjs similarity index 100% rename from services/departments-scraper/build.mjs rename to services/departments-terms-scraper/build.mjs diff --git a/services/departments-scraper/package.json b/services/departments-terms-scraper/package.json similarity index 100% rename from services/departments-scraper/package.json rename to services/departments-terms-scraper/package.json diff --git a/services/departments-scraper/src/index.ts b/services/departments-terms-scraper/src/index.ts similarity index 82% rename from services/departments-scraper/src/index.ts rename to services/departments-terms-scraper/src/index.ts index 1e8516fd..76829a17 100644 --- a/services/departments-scraper/src/index.ts +++ b/services/departments-terms-scraper/src/index.ts @@ -1,14 +1,14 @@ import { load } from "cheerio"; import fetch from "cross-fetch"; -async function loadWebSoc() { +async function fetchWebSoc() { const response = await fetch("https://www.reg.uci.edu/perl/WebSoc"); const body = await response.text(); return load(body); } export async function getDepartments(): Promise { - const $ = await loadWebSoc(); + const $ = await fetchWebSoc(); const departments: string[] = []; $('select[name="Dept"] option').each((_index, element) => { @@ -23,7 +23,7 @@ export async function getDepartments(): Promise { } export async function getTerms(): Promise { - const $ = await loadWebSoc(); + const $ = await fetchWebSoc(); const terms: string[] = []; $('select[name="YearTerm"] option').each((_index, element) => { @@ -33,6 +33,3 @@ export async function getTerms(): Promise { return terms; } - -getDepartments().then(console.log); -getTerms().then(console.log);