-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route): add route of 深圳福田园岭小学 (#16876)
* Create namespace.ts * Add files via upload * Update dongtai.ts * Update gonggao.ts * Update gonggao.ts * Update gonggao.ts * Update dongtai.ts * Update gonggao.ts * Update gonggao.ts * Update gonggao.ts * Update gonggao.ts * Update dongtai.ts * Create namespace.ts * Add files via upload * Update articles.ts * Update articles.ts * Update articles.ts * Update articles.ts * Update articles.ts * Update articles.ts * Update articles.ts * route for 日经新闻半导体,产业聚焦 * Update scienceatechnology.ts * Update semi.ts * Delete lib/routes/yamap directory * Delete lib/routes/nikkei/semi.ts * Delete lib/routes/nikkei/scienceatechnology.ts * Update lib/routes/szftedu/dongtai.ts Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/routes/szftedu/namespace.ts Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/routes/szftedu/gonggao.ts Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update gonggao.ts * Update gonggao.ts * Update dongtai.ts * Update gonggao.ts * Update gonggao.ts * Update dongtai.ts * Update dongtai.ts * Update dongtai.ts * Update gonggao.ts * Update lib/routes/szftedu/gonggao.ts Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/routes/szftedu/dongtai.ts Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update dongtai.ts * Update dongtai.ts * fix: route name ---------
- Loading branch information
Showing
3 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Route } from '@/types'; | ||
import cache from '@/utils/cache'; | ||
import got from '@/utils/got'; | ||
import { load } from 'cheerio'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import timezone from '@/utils/timezone'; | ||
|
||
const host = 'https://ylxx.szftedu.cn/xx_5828/xydt_5829/bxfbx_6371/'; | ||
const baseLink = 'https://ylxx.szftedu.cn'; | ||
|
||
export const route: Route = { | ||
path: '/dongtai', | ||
categories: ['university'], | ||
example: '/szftedu/dongtai', | ||
parameters: {}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
name: '动态', | ||
maintainers: ['valuex'], | ||
handler, | ||
description: '', | ||
}; | ||
|
||
async function handler() { | ||
const link = host; | ||
const response = await got(link); | ||
const $ = load(response.data); | ||
const lists = $('div.pagenews04 div ul li') | ||
.toArray() | ||
.map((el) => ({ | ||
title: $('a', el).text().trim(), | ||
link: $('a', el).attr('href'), | ||
pubDate: timezone(parseDate($('span[class=canedit]', el).text()), 8), | ||
})); | ||
|
||
const items = await Promise.all( | ||
lists.map((item) => | ||
cache.tryGet(item.link, async () => { | ||
const thisUrl = item.link; | ||
const trueLink = thisUrl.includes('http') ? thisUrl : baseLink + thisUrl; | ||
const response = await got(trueLink); | ||
const $ = load(response.data); | ||
item.description = thisUrl.includes('http') ? $('#page-content').html() : $('div.TRS_Editor').html(); | ||
item.pubDate = timezone(parseDate($('#publish_time').first().text()), 8); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
return { | ||
title: '园岭小学动态', | ||
link: host, | ||
description: '园岭小学动态', | ||
item: items, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Route } from '@/types'; | ||
import cache from '@/utils/cache'; | ||
import got from '@/utils/got'; | ||
import { load } from 'cheerio'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import timezone from '@/utils/timezone'; | ||
|
||
const host = 'https://ylxx.szftedu.cn/xx_5828/xygg_5832/'; | ||
|
||
export const route: Route = { | ||
path: '/gonggao', | ||
categories: ['university'], | ||
example: '/szftedu/gonggao', | ||
parameters: {}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
name: '公告', | ||
maintainers: ['valuex'], | ||
handler, | ||
description: '', | ||
}; | ||
|
||
async function handler() { | ||
const link = host; | ||
const response = await got(link); | ||
const $ = load(response.data); | ||
|
||
const lists = $('div.pagenews04 div ul li') | ||
.toArray() | ||
.map((el) => ({ | ||
title: $('a', el).text().trim(), | ||
link: $('a', el).attr('href'), | ||
pubDate: timezone(parseDate($('span[class=canedit]', el).text()), 8), | ||
})); | ||
|
||
const items = await Promise.all( | ||
lists.map((item) => | ||
cache.tryGet(item.link, async () => { | ||
const thisUrl = item.link; | ||
const trueLink = thisUrl.includes('http') ? thisUrl : host + thisUrl.substring(1); | ||
const response = await got(trueLink); | ||
const $ = load(response.data); | ||
item.description = thisUrl.includes('http') ? $('#page-content').html() : $('div.TRS_Editor').html(); | ||
item.pubDate = timezone(parseDate($('.item').first().text().replace('发布时间:', '')), 8); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
return { | ||
title: '园岭小学公告', | ||
link: host, | ||
description: '园岭小学公告', | ||
item: items, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: '园岭小学', | ||
url: 'ylxx.szftedu.cn', | ||
}; |