Skip to content

Commit

Permalink
feat: finalized scrape cousres pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Jul 24, 2024
1 parent 2f44084 commit af81b41
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion runners/update-courses.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import schedule from 'node-schedule';

const job = schedule.scheduleJob('8 * * * *', async () => {
// Run every day at 8:00 AM
// 8 AM (GMT+8) = 0 AM (GMT)
const job = schedule.scheduleJob('0 0 * * *', async () => {
try {
console.log('syncing courses begin uwu')
const res = await fetch('http://localhost:8080/api/scrape-archived-courses?semester=11310', {
Expand All @@ -9,6 +11,18 @@ const job = schedule.scheduleJob('8 * * * *', async () => {
'Authorization': `Bearer ${process.env.CRON_SECRET}`
}
});
const res2 = await fetch('http://localhost:8080/api/scrape-syllabus?semester=11310', {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.CRON_SECRET}`
}
});
const res3 = await fetch('http://localhost:8080/api/sync-algolia?semester=11310', {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.CRON_SECRET}`
}
});
console.log('syncing courses end uwu')
} catch (e) {
console.error('error calling scrape-courses', e);
Expand Down

0 comments on commit af81b41

Please sign in to comment.