|
| 1 | +import { Route } from '@/types'; |
| 2 | +import got from '@/utils/got'; |
| 3 | +import { parseDate } from '@/utils/parse-date'; |
| 4 | + |
| 5 | +export const route: Route = { |
| 6 | + path: '/nictation', |
| 7 | + categories: ['new-media'], |
| 8 | + example: '/tmtpost/word', |
| 9 | + parameters: {}, |
| 10 | + features: { |
| 11 | + requireConfig: false, |
| 12 | + requirePuppeteer: false, |
| 13 | + antiCrawler: false, |
| 14 | + supportBT: false, |
| 15 | + supportPodcast: false, |
| 16 | + supportScihub: false, |
| 17 | + }, |
| 18 | + radar: { |
| 19 | + source: ['www.tmtpost.com'], |
| 20 | + }, |
| 21 | + name: '快报', |
| 22 | + maintainers: ['defp'], |
| 23 | + handler, |
| 24 | + url: 'www.tmtpost.com/nictation', |
| 25 | +}; |
| 26 | + |
| 27 | +async function handler() { |
| 28 | + const currentTime = Math.floor(Date.now() / 1000); |
| 29 | + const oneHourAgo = currentTime - 3600; |
| 30 | + const url = 'https://api.tmtpost.com/v1/word/list'; |
| 31 | + |
| 32 | + const response = await got({ |
| 33 | + method: 'get', |
| 34 | + url, |
| 35 | + searchParams: { |
| 36 | + time_start: oneHourAgo, |
| 37 | + time_end: currentTime, |
| 38 | + limit: 40, |
| 39 | + fields: ['share_description', 'share_image', 'word_comments', 'stock_list', 'is_important', 'duration', 'word_classify', 'share_link'].join(';'), |
| 40 | + }, |
| 41 | + headers: { |
| 42 | + 'app-version': 'web1.0', |
| 43 | + }, |
| 44 | + }); |
| 45 | + |
| 46 | + const data = response.data.data; |
| 47 | + |
| 48 | + return { |
| 49 | + title: '钛媒体 - 快报', |
| 50 | + link: 'https://www.tmtpost.com/nictation', |
| 51 | + item: data.map((item) => ({ |
| 52 | + title: item.title, |
| 53 | + description: item.detail, |
| 54 | + pubDate: parseDate(item.time_published, 'X'), |
| 55 | + link: item.share_link || `https://www.tmtpost.com/nictation/${item.guid}.html`, |
| 56 | + author: item.author_name, |
| 57 | + })), |
| 58 | + }; |
| 59 | +} |
0 commit comments