Skip to content

Commit

Permalink
Merge branch 'DIYgod:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoshame authored Oct 25, 2024
2 parents 5c0985a + 54083d0 commit 46c870d
Show file tree
Hide file tree
Showing 52 changed files with 414 additions and 128 deletions.
32 changes: 29 additions & 3 deletions lib/routes/acfun/article.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
Expand Down Expand Up @@ -37,9 +37,35 @@ const timeRangeEnum = new Set(['all', 'oneDay', 'threeDay', 'oneWeek', 'oneMonth

export const route: Route = {
path: '/article/:categoryId/:sortType?/:timeRange?',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/acfun/article/110',
parameters: { categoryId: '分区 ID,见下表', sortType: '排序,见下表,默认为 `createTime`', timeRange: '时间范围,见下表,仅在排序是 `hotScore` 有效,默认为 `all`' },
parameters: {
categoryId: {
description: '分区 ID',
options: Object.keys(categoryMap).map((id) => ({ value: id, label: categoryMap[id].title })),
},
sortType: {
description: '排序',
options: [
{ value: 'createTime', label: '最新发表' },
{ value: 'lastCommentTime', label: '最新动态' },
{ value: 'hotScore', label: '最热文章' },
],
default: 'createTime',
},
timeRange: {
description: '时间范围,仅在排序是 `hotScore` 有效',
options: [
{ value: 'all', label: '时间不限' },
{ value: 'oneDay', label: '24 小时' },
{ value: 'threeDay', label: '三天' },
{ value: 'oneWeek', label: '一周' },
{ value: 'oneMonth', label: '一个月' },
],
default: 'all',
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/acfun/bangumi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/bangumi/:id',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Videos,
example: '/acfun/bangumi/5022158',
parameters: { id: '番剧 id' },
features: {
Expand Down
6 changes: 4 additions & 2 deletions lib/routes/acfun/video.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
Expand All @@ -15,7 +15,9 @@ export const route: Route = {
parameters: {
uid: '用户 UID',
},
categories: ['anime'],
categories: ['anime', 'popular'],
example: '/acfun/user/video/6102',
view: ViewType.Videos,
maintainers: ['wdssmq'],
handler,
};
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/ainvest/news.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import { getHeaders, randomString, decryptAES } from './utils';

export const route: Route = {
path: '/news',
categories: ['finance'],
categories: ['finance', 'popular'],
example: '/ainvest/news',
parameters: {},
view: ViewType.Articles,
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/baidu/gushitong/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);

Expand All @@ -13,7 +13,8 @@ const STATUS_MAP = {

export const route: Route = {
path: '/gushitong/index',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Notifications,
example: '/baidu/gushitong/index',
parameters: {},
features: {
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/bigquant/collections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import MarkdownIt from 'markdown-it';
Expand All @@ -8,7 +8,8 @@ const md = MarkdownIt({

export const route: Route = {
path: '/collections',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/bigquant/collections',
parameters: {},
features: {
Expand Down
21 changes: 11 additions & 10 deletions lib/routes/binance/announcement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataItem, Route } from '@/types';
import { DataItem, Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
Expand Down Expand Up @@ -132,7 +132,8 @@ const handler: Route['handler'] = async (ctx) => {

export const route: Route = {
path: '/announcement/:type',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/binance/announcement/new-cryptocurrency-listing',
parameters: {
type: {
Expand All @@ -154,14 +155,14 @@ export const route: Route = {
description: `
Type category
- new-cryptocurrency-listing => New Cryptocurrency Listing
- latest-binance-news => Latest Binance News
- latest-activities => Latest Activities
- new-fiat-listings => New Fiat Listings
- api-updates => API Updates
- crypto-airdrop => Crypto Airdrop
- wallet-maintenance-updates => Wallet Maintenance Updates
- delisting => Delisting
- new-cryptocurrency-listing => New Cryptocurrency Listing
- latest-binance-news => Latest Binance News
- latest-activities => Latest Activities
- new-fiat-listings => New Fiat Listings
- api-updates => API Updates
- crypto-airdrop => Crypto Airdrop
- wallet-maintenance-updates => Wallet Maintenance Updates
- delisting => Delisting
`,
maintainers: ['enpitsulin'],
handler,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/bitget/announcement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataItem, Route } from '@/types';
import { DataItem, Route, ViewType } from '@/types';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';
import cache from '@/utils/cache';
Expand Down Expand Up @@ -139,7 +139,8 @@ const findTypeLabel = (type: string) => {

export const route: Route = {
path: '/announcement/:type/:lang?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/bitget/announcement/all/zh-CN',
parameters: {
type: {
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/bloomberg/authors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { load } from 'cheerio';
import got from '@/utils/got';
import rssParser from '@/utils/rss-parser';
Expand Down Expand Up @@ -30,7 +30,8 @@ const parseAuthorNewsList = async (slug) => {

export const route: Route = {
path: '/authors/:id/:slug/:source?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/bloomberg/authors/ARbTQlRLRjE/matthew-s-levine',
parameters: { id: 'Author ID, can be found in URL', slug: 'Author Slug, can be found in URL', source: 'Data source, either `api` or `rss`,`api` by default' },
features: {
Expand Down
10 changes: 7 additions & 3 deletions lib/routes/bloomberg/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { rootUrl, asyncPoolAll, parseNewsList, parseArticle } from './utils';
const site_title_mapping = {
'/': 'News',
Expand All @@ -17,10 +17,14 @@ const site_title_mapping = {

export const route: Route = {
path: '/:site?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/bloomberg/bbiz',
parameters: {
site: 'Site ID, can be found below',
site: {
description: 'Site ID, can be found below',
options: Object.keys(site_title_mapping).map((key) => ({ value: key, label: site_title_mapping[key] })),
},
},
features: {
requireConfig: false,
Expand Down
18 changes: 15 additions & 3 deletions lib/routes/bookfere/category.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/:category',
categories: ['reading'],
categories: ['reading', 'popular'],
view: ViewType.Articles,
example: '/bookfere/skills',
parameters: { category: '分类名' },
parameters: {
category: {
description: '分类名',
options: [
{ value: 'weekly', label: '每周一书' },
{ value: 'skills', label: '使用技巧' },
{ value: 'books', label: '图书推荐' },
{ value: 'news', label: '新闻速递' },
{ value: 'essay', label: '精选短文' },
],
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/cngal/weekly.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);

Expand All @@ -9,7 +9,8 @@ import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/weekly',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/cngal/weekly',
parameters: {},
features: {
Expand Down
13 changes: 11 additions & 2 deletions lib/routes/dlsite/campaign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,18 @@ const setUrl = (info) => {

export const route: Route = {
path: '/campaign/:type/:free?',
categories: ['anime'],
categories: ['anime', 'popular'],
example: '/dlsite/campaign/home',
parameters: { type: 'Type, see table above', free: 'Free only, empty means false, other value means true' },
parameters: {
type: {
description: '类型',
options: Object.values(infos).map((info) => ({ value: info.type, label: info.name })),
},
free: {
description: '免费',
options: [{ value: '1', label: '是' }],
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/dlsite/ci-en/article.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
Expand All @@ -7,7 +7,8 @@ import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/ci-en/:id/article',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/dlsite/ci-en/7400/article',
parameters: { id: 'Creator id, can be found in URL' },
features: {
Expand Down
12 changes: 9 additions & 3 deletions lib/routes/dlsite/new.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
Expand Down Expand Up @@ -53,9 +53,15 @@ const infos = {

export const route: Route = {
path: '/new/:type',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/dlsite/new/home',
parameters: { type: 'Type, see table below' },
parameters: {
type: {
description: '类型',
options: Object.values(infos).map((info) => ({ value: info.type, label: info.name })),
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/dora-world/article.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route, Data, DataItem } from '@/types';
import { Route, Data, DataItem, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import cache from '@/utils/cache';
Expand All @@ -9,7 +9,8 @@ const baseUrl = 'https://www.dora-world.com';

export const route: Route = {
path: '/article/:topic/:topicId?',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/dora-world/article/contents',
parameters: {
topic: 'Topic name, can be found in URL. For example: the topic name of [https://www.dora-world.com/movie](https://www.dora-world.com/movie) is `movie`',
Expand Down
18 changes: 15 additions & 3 deletions lib/routes/eastmoney/report/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
import cache from '@/utils/cache';
import got from '@/utils/got';
Expand All @@ -12,9 +12,21 @@ const __dirname = getCurrentPath(import.meta.url);

export const route: Route = {
path: '/report/:category',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/eastmoney/report/strategyreport',
parameters: { category: '研报类型' },
parameters: {
category: {
description: '研报类型',
options: [
{ value: 'strategyreport', label: '策略报告' },
{ value: 'macresearch', label: '宏观研究' },
{ value: 'brokerreport', label: '券商晨报' },
{ value: 'industry', label: '行业研报' },
{ value: 'stock', label: '个股研报' },
],
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/eastmoney/search/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { parseDate } from '@/utils/parse-date';
import got from '@/utils/got';
import timezone from '@/utils/timezone';

export const route: Route = {
path: '/search/:keyword',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/eastmoney/search/web3',
parameters: { keyword: '关键词,可以设置为自己需要检索的关键词' },
features: {
Expand Down
Loading

0 comments on commit 46c870d

Please sign in to comment.