forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2046 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
6 changed files
with
191 additions
and
27 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
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
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,9 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: 'éåŖä½', | ||
url: 'tmtpost.com', | ||
categories: ['new-media'], | ||
description: 'éåŖä½ęÆäø家äøę³Øäŗę°åŖä½é¢åēē§ęåŖä½', | ||
lang: 'zh-CN', | ||
}; |
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,59 @@ | ||
import { Route } from '@/types'; | ||
import got from '@/utils/got'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
|
||
export const route: Route = { | ||
path: '/nictation', | ||
categories: ['new-media'], | ||
example: '/tmtpost/word', | ||
parameters: {}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
radar: { | ||
source: ['www.tmtpost.com'], | ||
}, | ||
name: 'åæ«ę„', | ||
maintainers: ['defp'], | ||
handler, | ||
url: 'www.tmtpost.com/nictation', | ||
}; | ||
|
||
async function handler() { | ||
const currentTime = Math.floor(Date.now() / 1000); | ||
const oneHourAgo = currentTime - 3600; | ||
const url = 'https://api.tmtpost.com/v1/word/list'; | ||
|
||
const response = await got({ | ||
method: 'get', | ||
url, | ||
searchParams: { | ||
time_start: oneHourAgo, | ||
time_end: currentTime, | ||
limit: 40, | ||
fields: ['share_description', 'share_image', 'word_comments', 'stock_list', 'is_important', 'duration', 'word_classify', 'share_link'].join(';'), | ||
}, | ||
headers: { | ||
'app-version': 'web1.0', | ||
}, | ||
}); | ||
|
||
const data = response.data.data; | ||
|
||
return { | ||
title: 'éåŖä½ - åæ«ę„', | ||
link: 'https://www.tmtpost.com/nictation', | ||
item: data.map((item) => ({ | ||
title: item.title, | ||
description: item.detail, | ||
pubDate: parseDate(item.time_published, 'X'), | ||
link: item.share_link || `https://www.tmtpost.com/nictation/${item.guid}.html`, | ||
author: item.author_name, | ||
})), | ||
}; | ||
} |
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,66 @@ | ||
import { Route } from '@/types'; | ||
import got from '@/utils/got'; | ||
import { load } from 'cheerio'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import cache from '@/utils/cache'; | ||
|
||
export const route: Route = { | ||
path: '/gs', | ||
categories: ['university'], | ||
example: '/tongji/gs', | ||
parameters: {}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
radar: [ | ||
{ | ||
source: ['gs.tongji.edu.cn/tzgg.htm', 'gs.tongji.edu.cn/'], | ||
}, | ||
], | ||
name: 'ē ē©¶ēé¢éē„å ¬å', | ||
maintainers: ['sitdownkevin'], | ||
handler, | ||
url: 'gs.tongji.edu.cn/tzgg.htm', | ||
}; | ||
|
||
async function getNoticeContent(item) { | ||
const response = await got(item.link); | ||
const $ = load(response.body); | ||
const content = $('#vsb_content').html(); | ||
item.description = content; | ||
return item; | ||
} | ||
|
||
async function handler() { | ||
const baseUrl = 'https://gs.tongji.edu.cn'; | ||
const response = await got(`${baseUrl}/tzgg.htm`); | ||
const $ = load(response.body); | ||
const container = $('body > div > div.con_list.ma0a > div > div.list_content_right > div.list_list > ul'); | ||
const items = container | ||
.find('li') | ||
.toArray() | ||
.map((item) => { | ||
const title = $(item).find('a').attr('title'); | ||
const linkRaw = $(item).find('a').attr('href'); | ||
const link = linkRaw.startsWith('http') ? linkRaw : `${baseUrl}/${linkRaw}`; | ||
const pubDate = $(item).find('span').text(); | ||
return { title, link, pubDate: parseDate(pubDate, 'YYYY-MM-DD') }; | ||
}); | ||
|
||
const itemsWithContent = await Promise.all(items.map((item) => cache.tryGet(item.link, () => getNoticeContent(item)))); | ||
|
||
return { | ||
title: 'åęµå¤§å¦ē ē©¶ēé¢', | ||
link: baseUrl, | ||
description: 'åęµå¤§å¦ē ē©¶ēé¢éē„å ¬å', | ||
image: 'https://upload.wikimedia.org/wikipedia/zh/f/f8/Tongji_University_Emblem.svg', | ||
icon: 'https://upload.wikimedia.org/wikipedia/zh/f/f8/Tongji_University_Emblem.svg', | ||
logo: 'https://upload.wikimedia.org/wikipedia/zh/f/f8/Tongji_University_Emblem.svg', | ||
item: itemsWithContent, | ||
}; | ||
} |
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