rsshub 1.0.0-master.ed8fa7a → 1.0.0-master.edce496

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: '同花顺财经',
5
+ url: '10jqka.com.cn',
6
+ categories: ['finance'],
7
+ description: '',
8
+ };
@@ -0,0 +1,143 @@
1
+ import { Route } from '@/types';
2
+
3
+ import got from '@/utils/got';
4
+ import { load } from 'cheerio';
5
+ import iconv from 'iconv-lite';
6
+ import { parseDate } from '@/utils/parse-date';
7
+
8
+ export const handler = async (ctx) => {
9
+ const { tag } = ctx.req.param();
10
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 20;
11
+
12
+ const rootUrl = 'https://news.10jqka.com.cn';
13
+ const apiUrl = new URL('tapp/news/push/stock', rootUrl).href;
14
+ const currentUrl = new URL('realtimenews.html', rootUrl).href;
15
+
16
+ const { data: currentResponse } = await got(currentUrl, {
17
+ responseType: 'buffer',
18
+ });
19
+
20
+ const $ = load(iconv.decode(currentResponse, 'gbk'));
21
+
22
+ const language = $('html').prop('lang');
23
+
24
+ const { data: response } = await got(apiUrl, {
25
+ searchParams: {
26
+ page: 1,
27
+ tag: tag ?? '',
28
+ },
29
+ });
30
+
31
+ const items =
32
+ response.data?.list.slice(0, limit).map((item) => {
33
+ const title = item.title;
34
+ const description = item.digest;
35
+ const guid = `10jqka-${item.seq}`;
36
+ const image = item.picUrl;
37
+
38
+ return {
39
+ title,
40
+ description,
41
+ pubDate: parseDate(item.ctime, 'X'),
42
+ link: item.url,
43
+ category: [...new Set([item.color === '2' ? '重要' : undefined, ...item.tags.map((c) => c.name), ...item.tagInfo.map((c) => c.name)])].filter(Boolean),
44
+ author: item.source,
45
+ guid,
46
+ id: guid,
47
+ content: {
48
+ html: description,
49
+ text: description,
50
+ },
51
+ image,
52
+ banner: item.picUrl,
53
+ updated: parseDate(item.rtime, 'X'),
54
+ language,
55
+ };
56
+ }) ?? [];
57
+
58
+ const title = $('title').text();
59
+ const image = $('h1 a img').prop('src');
60
+
61
+ return {
62
+ title,
63
+ description: title.split(/_/).pop(),
64
+ link: currentUrl,
65
+ item: items,
66
+ allowEmpty: true,
67
+ image,
68
+ author: $('meta[property="og:site_name"]').prop('content'),
69
+ language,
70
+ };
71
+ };
72
+
73
+ export const route: Route = {
74
+ path: '/realtimenews/:tag?',
75
+ name: '7×24小时要闻直播',
76
+ url: 'news.10jqka.com.cn',
77
+ maintainers: ['nczitzk'],
78
+ handler,
79
+ example: '/10jqka/realtimenews',
80
+ parameters: { tag: '标签,默认为全部' },
81
+ description: `:::tip
82
+ 若订阅 [7×24小时要闻直播](https://news.10jqka.com.cn/realtimenews.html) 的 \`公告\` 标签。将 \`公告\` 作为标签参数填入,此时路由为 [\`/10jqka/realtimenews/公告\`](https://rsshub.app/10jqka/realtimenews/公告)。
83
+
84
+ 若订阅 [7×24小时要闻直播](https://news.10jqka.com.cn/realtimenews.html) 的 \`公告\` 和 \`A股\` 标签。将 \`公告,A股\` 作为标签参数填入,此时路由为 [\`/10jqka/realtimenews/公告,A股\`](https://rsshub.app/10jqka/realtimenews/公告,A股)。
85
+ :::
86
+
87
+ | 全部 | 重要 | A股 | 港股 | 美股 | 机会 | 异动 | 公告 |
88
+ | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
89
+ `,
90
+ categories: ['finance'],
91
+
92
+ features: {
93
+ requireConfig: false,
94
+ requirePuppeteer: false,
95
+ antiCrawler: false,
96
+ supportRadar: true,
97
+ supportBT: false,
98
+ supportPodcast: false,
99
+ supportScihub: false,
100
+ },
101
+ radar: [
102
+ {
103
+ title: '全部',
104
+ source: ['news.10jqka.com.cn/realtimenews.html'],
105
+ target: '/realtimenews/全部',
106
+ },
107
+ {
108
+ title: '重要',
109
+ source: ['news.10jqka.com.cn/realtimenews.html'],
110
+ target: '/realtimenews/重要',
111
+ },
112
+ {
113
+ title: 'A股',
114
+ source: ['news.10jqka.com.cn/realtimenews.html'],
115
+ target: '/realtimenews/A股',
116
+ },
117
+ {
118
+ title: '港股',
119
+ source: ['news.10jqka.com.cn/realtimenews.html'],
120
+ target: '/realtimenews/港股',
121
+ },
122
+ {
123
+ title: '美股',
124
+ source: ['news.10jqka.com.cn/realtimenews.html'],
125
+ target: '/realtimenews/美股',
126
+ },
127
+ {
128
+ title: '机会',
129
+ source: ['news.10jqka.com.cn/realtimenews.html'],
130
+ target: '/realtimenews/机会',
131
+ },
132
+ {
133
+ title: '异动',
134
+ source: ['news.10jqka.com.cn/realtimenews.html'],
135
+ target: '/realtimenews/异动',
136
+ },
137
+ {
138
+ title: '公告',
139
+ source: ['news.10jqka.com.cn/realtimenews.html'],
140
+ target: '/realtimenews/公告',
141
+ },
142
+ ],
143
+ };
@@ -9,7 +9,7 @@ export const route: Route = {
9
9
  categories: ['social-media'],
10
10
  example: '/rss3/vitalik.eth',
11
11
  name: 'Account Activities',
12
- maintainers: ['DIYgod'],
12
+ maintainers: ['DIYgod', 'pseudoyu'],
13
13
  url: 'docs.rss3.io/api-reference#tag/decentralized/GET/decentralized/%7Baccount%7D',
14
14
  handler,
15
15
  description: 'Retrieve the activities associated with a specified account in the decentralized system.',
@@ -123,6 +123,11 @@ export const route: Route = {
123
123
  async function handler(ctx) {
124
124
  const { account, network, tag } = ctx.req.param();
125
125
 
126
+ // Check if account contains "://" or "/"
127
+ if (account.includes('://') || account.includes('/')) {
128
+ throw new Error('Account should not contain "://" or path components');
129
+ }
130
+
126
131
  const { data } = await ofetch(
127
132
  `https://gi.rss3.io/decentralized/${account}?${new URLSearchParams({
128
133
  limit: '20',
@@ -1,6 +1,6 @@
1
1
  import { Resource } from '@opentelemetry/resources';
2
2
  import { PrometheusExporter, PrometheusSerializer } from '@opentelemetry/exporter-prometheus';
3
- import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
3
+ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
4
4
  import { MeterProvider } from '@opentelemetry/sdk-metrics';
5
5
  import { Attributes } from '@opentelemetry/api';
6
6
  import { config } from '@/config';
@@ -21,7 +21,7 @@ const exporter = new PrometheusExporter({});
21
21
 
22
22
  const provider = new MeterProvider({
23
23
  resource: new Resource({
24
- [SEMRESATTRS_SERVICE_NAME]: 'rsshub',
24
+ [ATTR_SERVICE_NAME]: 'rsshub',
25
25
  }),
26
26
  readers: [exporter],
27
27
  });
@@ -1,11 +1,11 @@
1
1
  import { Resource } from '@opentelemetry/resources';
2
2
  import { BasicTracerProvider, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
3
- import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
3
+ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
4
4
  import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
5
5
 
6
6
  const provider = new BasicTracerProvider({
7
7
  resource: new Resource({
8
- [SEMRESATTRS_SERVICE_NAME]: 'rsshub',
8
+ [ATTR_SERVICE_NAME]: 'rsshub',
9
9
  }),
10
10
  });
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsshub",
3
- "version": "1.0.0-master.ed8fa7a",
3
+ "version": "1.0.0-master.edce496",
4
4
  "description": "Make RSS Great Again!",
5
5
  "keywords": [
6
6
  "RSS"
@@ -36,11 +36,11 @@
36
36
  "@hono/zod-openapi": "0.16.4",
37
37
  "@notionhq/client": "2.2.15",
38
38
  "@opentelemetry/api": "1.9.0",
39
- "@opentelemetry/exporter-prometheus": "0.53.0",
39
+ "@opentelemetry/exporter-prometheus": "0.54.0",
40
40
  "@opentelemetry/exporter-trace-otlp-http": "0.53.0",
41
- "@opentelemetry/resources": "1.26.0",
42
- "@opentelemetry/sdk-metrics": "1.26.0",
43
- "@opentelemetry/sdk-trace-base": "1.26.0",
41
+ "@opentelemetry/resources": "1.27.0",
42
+ "@opentelemetry/sdk-metrics": "1.27.0",
43
+ "@opentelemetry/sdk-trace-base": "1.27.0",
44
44
  "@opentelemetry/semantic-conventions": "1.27.0",
45
45
  "@postlight/parser": "2.2.3",
46
46
  "@rss3/sdk": "0.0.23",