Skip to content

Commit

Permalink
feat(route): add more popular financial routes
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Oct 25, 2024
1 parent e480f60 commit 54083d0
Show file tree
Hide file tree
Showing 36 changed files with 310 additions and 92 deletions.
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/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
5 changes: 3 additions & 2 deletions lib/routes/eastmoney/ttjj/user.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';

export const route: Route = {
path: '/ttjj/user/:uid',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.SocialMedia,
example: '/eastmoney/ttjj/user/6551094298949188',
parameters: { uid: '用户id, 可以通过天天基金App分享用户主页到浏览器,在相应的URL中找到' },
features: {
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/fastbull/express-news.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 got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/express-news',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/fastbull/express-news',
parameters: {},
features: {
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/fastbull/news.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 @@ -11,7 +11,8 @@ import path from 'node:path';

export const route: Route = {
path: ['/news', '/'],
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/fastbull/news',
parameters: {},
features: {
Expand Down
12 changes: 9 additions & 3 deletions lib/routes/finviz/news.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 timezone from '@/utils/timezone';
Expand All @@ -12,9 +12,15 @@ const categories = {

export const route: Route = {
path: '/:category?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/finviz',
parameters: { category: 'Category, see below, News by default' },
parameters: {
category: {
description: 'Category, see below, News by default',
options: Object.keys(categories).map((key) => ({ value: key, label: key })),
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
33 changes: 30 additions & 3 deletions lib/routes/followin/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { apiUrl, favicon, getBParam, getBuildId, getGToken, parseList, parseItem } from './utils';

export const route: Route = {
path: '/:categoryId?/:lang?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/followin',
parameters: { categoryId: 'Category ID, see table below, `1` by default', lang: 'Language, see table below, `en` by default' },
parameters: {
categoryId: {
description: 'Category ID',
options: [
{ value: '1', label: 'For You' },
{ value: '9', label: 'Market' },
{ value: '13', label: 'Meme' },
{ value: '14', label: 'BRC20' },
{ value: '3', label: 'NFT' },
{ value: '5', label: 'Thread' },
{ value: '6', label: 'In-depth' },
{ value: '8', label: 'Tutorials' },
{ value: '11', label: 'Videos' },
],
default: '1',
},
lang: {
description: 'Language',
options: [
{ value: 'en', label: 'English' },
{ value: 'zh-Hans', label: '简体中文' },
{ value: 'zh-Hant', label: '繁體中文' },
{ value: 'vi', label: 'Tiếng Việt' },
],
default: 'en',
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
18 changes: 15 additions & 3 deletions lib/routes/followin/news.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 cache from '@/utils/cache';
import got from '@/utils/got';
import { baseUrl, favicon, getBuildId, parseList, parseItem } from './utils';

export const route: Route = {
path: '/news/:lang?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/followin/news',
parameters: { lang: 'Language, see table above, `en` by default' },
parameters: {
lang: {
description: 'Language',
options: [
{ value: 'en', label: 'English' },
{ value: 'zh-Hans', label: '简体中文' },
{ value: 'zh-Hant', label: '繁體中文' },
{ value: 'vi', label: 'Tiếng Việt' },
],
default: 'en',
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/fx678/kx.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 { load } from 'cheerio';
import got from '@/utils/got';
Expand All @@ -7,7 +7,8 @@ import timezone from '@/utils/timezone';

export const route: Route = {
path: '/kx',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Notifications,
example: '/fx678/kx',
parameters: {},
features: {
Expand Down
18 changes: 15 additions & 3 deletions lib/routes/gelonghui/home.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import { parseItem } from './utils';

export const route: Route = {
path: '/home/:tag?',
categories: ['finance'],
categories: ['finance', 'popular'],
view: ViewType.Articles,
example: '/gelonghui/home',
parameters: { tag: '分类标签,见下表,默认为 `web_home_page`' },
parameters: {
tag: {
description: '分类标签,见下表,默认为 `web_home_page`',
options: [
{ value: 'web_home_page', label: '推荐' },
{ value: 'stock', label: '股票' },
{ value: 'fund', label: '基金' },
{ value: 'new_stock', label: '新股' },
{ value: 'research', label: '研报' },
],
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
Loading

0 comments on commit 54083d0

Please sign in to comment.