Skip to content

Commit

Permalink
Update _utils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
sitdownkevin committed Nov 9, 2024
1 parent 163c5c6 commit 81c8086
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/routes/tongji/sem/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';

import { config } from '@/config';

export async function getNotifByPage(pageNumber: number) {
const pageUrl: string = `https://sem.tongji.edu.cn/semch/category/frontpage/notice/page/${pageNumber}`;

try {
const response = await got.get(pageUrl, {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.101.76 Safari/537.36',
'User-Agent': config.ua,
},
});

Expand Down Expand Up @@ -41,7 +43,7 @@ export async function getLastPageNumber() {
try {
const response = await got.get('https://sem.tongji.edu.cn/semch/category/frontpage/notice', {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.101.76 Safari/537.36',
'User-Agent': config.ua,
},
});
const html = response.body;
Expand Down

0 comments on commit 81c8086

Please sign in to comment.