Skip to content

Commit

Permalink
fix: move nthumods ocr url to env, closes #500
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Sep 28, 2024
1 parent 2beeaa0 commit f17e47d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ GITHUB_CLIENT_ID=Iv23lisqArfcAbBMGOXe
CLOUDFLARE_KV_SHORTLINKS_NAMESPACE=4f141ed7ad0b4113b8e61a53710b653f
CLOUDFLARE_WORKER_ACCOUNT_ID=50396718bfac13dffb7727aad0e82150
NEXT_PUBLIC_ALGOLIA_APP_ID=NT48R1WDTS
NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=6dfe4655a78904f8b01432e7db3b8d64
NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=6dfe4655a78904f8b01432e7db3b8d64
NTHUMODS_OCR_BASE_URL=https://ocr.nthumods.com
2 changes: 1 addition & 1 deletion src/lib/headless_ais.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export const signInToCCXP = async (
//fetch the image from the url and send as base64
console.log("Fetching CAPTCHA");
answer = await fetch(
`https://ocr.nthumods.com/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/auth_img.php?pwdstr=${pwdstr}`,
`${process.env.NTHUMODS_OCR_BASE_URL}/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/auth_img.php?pwdstr=${pwdstr}`,
).then((res) => res.text());
console.log("Time taken", Date.now() - startTime);
startTime = Date.now();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/scrapers/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const scrapeArchivedCourses = async (semester: string) => {
//fetch the image from the url and send as base64
console.log("ACIXSTORE: ", ACIXSTORE);
answer = await fetch(
`https://ocr.nthumods.com/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/JH/mod/auth_img/auth_img.php?ACIXSTORE=${ACIXSTORE}`,
`${process.env.NTHUMODS_OCR_BASE_URL}/?url=https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/JH/mod/auth_img/auth_img.php?ACIXSTORE=${ACIXSTORE}`,
).then((res) => res.text());
console.log(answer);
if (answer.length == 3) break;
Expand Down

0 comments on commit f17e47d

Please sign in to comment.