rsshub 1.0.0-master.d2b1df9 → 1.0.0-master.d2bf7b3
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.
- package/lib/config.js +3 -0
- package/lib/middleware/cache/index.js +3 -0
- package/lib/router.js +5 -5
- package/lib/v2/bangumi/maintainer.js +1 -0
- package/lib/v2/bangumi/online.js +26 -0
- package/lib/v2/bangumi/radar.js +13 -2
- package/lib/v2/bangumi/router.js +1 -0
- package/lib/v2/bangumi/templates/image.art +1 -0
- package/lib/v2/bilibili/collection.js +34 -0
- package/lib/v2/bilibili/maintainer.js +1 -0
- package/lib/v2/bilibili/radar.js +9 -0
- package/lib/v2/bilibili/router.js +1 -0
- package/lib/v2/china/maintainer.js +4 -0
- package/lib/v2/china/news/highlights/news.js +40 -0
- package/lib/v2/china/news/military/news.js +31 -0
- package/lib/v2/china/radar.js +21 -0
- package/lib/v2/china/router.js +4 -0
- package/lib/v2/csdn/blog.js +39 -0
- package/lib/v2/csdn/maintainer.js +3 -0
- package/lib/v2/csdn/radar.js +13 -0
- package/lib/v2/csdn/router.js +3 -0
- package/lib/v2/douyu/post.js +9 -2
- package/lib/v2/github/comments.js +3 -4
- package/lib/v2/hupu/bbs.js +23 -23
- package/lib/v2/huxiu/maintainer.js +1 -0
- package/lib/v2/huxiu/moment.js +40 -0
- package/lib/v2/huxiu/radar.js +6 -0
- package/lib/v2/huxiu/router.js +1 -0
- package/lib/v2/huxiu/templates/moment.art +16 -0
- package/lib/v2/iwara/maintainer.js +1 -0
- package/lib/v2/iwara/radar.js +6 -0
- package/lib/v2/iwara/router.js +1 -0
- package/lib/v2/iwara/subscriptions.js +49 -0
- package/lib/v2/iwara/templates/subscriptions.art +1 -0
- package/lib/v2/leetcode/dailyquestion-solution-cn.js +183 -0
- package/lib/v2/leetcode/dailyquestion-solution-en.js +213 -0
- package/lib/v2/leetcode/maintainer.js +1 -0
- package/lib/v2/leetcode/radar.js +12 -0
- package/lib/v2/leetcode/router.js +2 -0
- package/lib/v2/lovelive-anime/maintainer.js +3 -0
- package/lib/v2/lovelive-anime/news.js +56 -0
- package/lib/v2/lovelive-anime/radar.js +13 -0
- package/lib/v2/lovelive-anime/router.js +3 -0
- package/lib/v2/lovelive-anime/templates/description.art +1 -0
- package/lib/v2/macfilos/blog.js +61 -0
- package/lib/v2/macfilos/maintainer.js +3 -0
- package/lib/v2/macfilos/radar.js +13 -0
- package/lib/v2/macfilos/router.js +3 -0
- package/lib/v2/meteor/boards.js +11 -0
- package/lib/v2/meteor/index.js +45 -0
- package/lib/v2/meteor/maintainer.js +4 -0
- package/lib/v2/meteor/radar.js +19 -0
- package/lib/v2/meteor/router.js +4 -0
- package/lib/v2/meteor/templates/desc.art +7 -0
- package/lib/v2/meteor/utils.js +90 -0
- package/lib/v2/nikkei-cn/index.js +4 -1
- package/lib/v2/nua/gra.js +56 -0
- package/lib/v2/nua/maintainer.js +3 -0
- package/lib/v2/nua/radar.js +13 -0
- package/lib/v2/nua/router.js +3 -0
- package/lib/v2/oschina/maintainer.js +6 -0
- package/lib/{routes → v2}/oschina/news.js +35 -39
- package/lib/v2/oschina/radar.js +33 -0
- package/lib/v2/oschina/router.js +6 -0
- package/lib/v2/oschina/topic.js +53 -0
- package/lib/v2/oschina/user.js +50 -0
- package/lib/v2/plurk/anonymous.js +23 -0
- package/lib/v2/plurk/hotlinks.js +20 -0
- package/lib/v2/plurk/maintainer.js +9 -0
- package/lib/v2/plurk/news.js +23 -0
- package/lib/v2/plurk/radar.js +56 -0
- package/lib/v2/plurk/router.js +9 -0
- package/lib/v2/plurk/search.js +27 -0
- package/lib/v2/plurk/top.js +29 -0
- package/lib/v2/plurk/topic.js +33 -0
- package/lib/v2/plurk/user.js +31 -0
- package/lib/v2/plurk/utils.js +56 -0
- package/lib/v2/segmentfault/blogs.js +38 -0
- package/lib/v2/segmentfault/maintainer.js +1 -0
- package/lib/v2/segmentfault/radar.js +8 -2
- package/lib/v2/segmentfault/router.js +1 -0
- package/lib/v2/sensortower/blog.js +69 -0
- package/lib/v2/sensortower/maintainer.js +3 -0
- package/lib/v2/sensortower/radar.js +13 -0
- package/lib/v2/sensortower/router.js +3 -0
- package/lib/v2/sensortower/templates/description.art +9 -0
- package/lib/v2/taptap/templates/imagePost.art +3 -0
- package/lib/v2/taptap/templates/videoPost.art +2 -1
- package/lib/v2/taptap/topic.js +33 -27
- package/lib/v2/taptap/utils.js +13 -8
- package/lib/v2/test/index.js +15 -0
- package/lib/v2/trending/allTrending.js +46 -19
- package/lib/v2/trending/templates/content.art +1 -0
- package/lib/v2/twitter/maintainer.js +1 -1
- package/lib/v2/twitter/router.js +1 -1
- package/lib/v2/twitter/web-api/twitter-api.js +1 -0
- package/lib/v2/warthunder/maintainer.js +3 -0
- package/lib/v2/warthunder/news.js +49 -0
- package/lib/v2/warthunder/radar.js +13 -0
- package/lib/v2/warthunder/router.js +3 -0
- package/lib/v2/warthunder/templates/description.art +1 -0
- package/lib/v2/xyzrank/index.js +111 -0
- package/lib/v2/xyzrank/maintainer.js +6 -0
- package/lib/v2/xyzrank/radar.js +31 -0
- package/lib/v2/xyzrank/router.js +3 -0
- package/lib/v2/xyzrank/templates/description.art +12 -0
- package/lib/v2/zaobao/util.js +6 -6
- package/lib/v2/zuvio/boards.js +14 -0
- package/lib/v2/zuvio/radar.js +13 -0
- package/lib/v2/zuvio/router.js +4 -0
- package/lib/v2/zuvio/student5.js +58 -0
- package/lib/v2/zuvio/templates/img.art +2 -0
- package/lib/v2/zuvio/templates/link.art +7 -0
- package/lib/v2/zuvio/templates/ref_article.art +8 -0
- package/lib/v2/zuvio/templates/rss.art +1 -0
- package/lib/v2/zuvio/templates/youtube.art +2 -0
- package/lib/v2/zuvio/utils.js +61 -0
- package/package.json +14 -15
- package/lib/routes/oschina/topic.js +0 -54
- package/lib/routes/oschina/u.js +0 -57
- package/lib/routes/oschina/user.js +0 -57
- package/lib/v2/hupu/templates/description.art +0 -6
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const showdown = require('showdown');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const baseurl = `https://leetcode.cn`;
|
|
7
|
+
const url = `${baseurl}/graphql/`;
|
|
8
|
+
const headers = {
|
|
9
|
+
'content-type': 'application/json',
|
|
10
|
+
};
|
|
11
|
+
const emoji = {
|
|
12
|
+
Medium: '🟡',
|
|
13
|
+
Easy: '🟢',
|
|
14
|
+
Hard: '🔴',
|
|
15
|
+
};
|
|
16
|
+
// 获取每日一题
|
|
17
|
+
const data = (
|
|
18
|
+
await got({
|
|
19
|
+
method: 'post',
|
|
20
|
+
url,
|
|
21
|
+
json: {
|
|
22
|
+
operationName: 'questionOfToday',
|
|
23
|
+
query: `query questionOfToday {
|
|
24
|
+
todayRecord {
|
|
25
|
+
date
|
|
26
|
+
userStatus
|
|
27
|
+
question {
|
|
28
|
+
questionId
|
|
29
|
+
frontendQuestionId: questionFrontendId
|
|
30
|
+
difficulty
|
|
31
|
+
title
|
|
32
|
+
titleCn: translatedTitle
|
|
33
|
+
titleSlug
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}`,
|
|
37
|
+
variables: {},
|
|
38
|
+
},
|
|
39
|
+
headers,
|
|
40
|
+
})
|
|
41
|
+
).data.data;
|
|
42
|
+
const questionTitle = data.todayRecord[0].question.titleSlug;
|
|
43
|
+
const questionUrl = `${baseurl}/problems/${questionTitle}/`;
|
|
44
|
+
|
|
45
|
+
// 获取题目内容
|
|
46
|
+
const question = (
|
|
47
|
+
await got({
|
|
48
|
+
method: 'post',
|
|
49
|
+
url,
|
|
50
|
+
json: {
|
|
51
|
+
operationName: 'questionData',
|
|
52
|
+
query: `query questionData($titleSlug: String!) {
|
|
53
|
+
question(titleSlug: $titleSlug) {
|
|
54
|
+
questionId
|
|
55
|
+
questionFrontendId
|
|
56
|
+
categoryTitle
|
|
57
|
+
boundTopicId
|
|
58
|
+
title
|
|
59
|
+
titleSlug
|
|
60
|
+
content
|
|
61
|
+
translatedTitle
|
|
62
|
+
translatedContent
|
|
63
|
+
isPaidOnly
|
|
64
|
+
difficulty
|
|
65
|
+
likes
|
|
66
|
+
}
|
|
67
|
+
}`,
|
|
68
|
+
variables: {
|
|
69
|
+
titleSlug: questionTitle,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
headers,
|
|
73
|
+
})
|
|
74
|
+
).data.data.question;
|
|
75
|
+
const diffEmoji = emoji[question.difficulty] || '';
|
|
76
|
+
// 获取题解(点赞前3)
|
|
77
|
+
const articles = (
|
|
78
|
+
await got({
|
|
79
|
+
method: 'post',
|
|
80
|
+
url,
|
|
81
|
+
json: {
|
|
82
|
+
operationName: 'questionSolutionArticles',
|
|
83
|
+
query: `query questionSolutionArticles($questionSlug: String!, $skip: Int, $first: Int, $orderBy: SolutionArticleOrderBy, $userInput: String, $tagSlugs: [String!]) {
|
|
84
|
+
questionSolutionArticles(questionSlug: $questionSlug, skip: $skip, first: $first, orderBy: $orderBy, userInput: $userInput, tagSlugs: $tagSlugs) {
|
|
85
|
+
totalNum
|
|
86
|
+
edges {
|
|
87
|
+
node {
|
|
88
|
+
...solutionArticle
|
|
89
|
+
__typename
|
|
90
|
+
}
|
|
91
|
+
__typename
|
|
92
|
+
}
|
|
93
|
+
__typename
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
fragment solutionArticle on SolutionArticleNode {
|
|
97
|
+
uuid
|
|
98
|
+
title
|
|
99
|
+
slug
|
|
100
|
+
createdAt
|
|
101
|
+
thumbnail
|
|
102
|
+
author {
|
|
103
|
+
username
|
|
104
|
+
}
|
|
105
|
+
summary
|
|
106
|
+
}`,
|
|
107
|
+
variables: {
|
|
108
|
+
questionSlug: questionTitle,
|
|
109
|
+
first: 3,
|
|
110
|
+
skip: 0,
|
|
111
|
+
orderBy: 'MOST_UPVOTE',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
headers,
|
|
115
|
+
})
|
|
116
|
+
).data.data.questionSolutionArticles.edges;
|
|
117
|
+
// 获取题解内容
|
|
118
|
+
const articleContent = (
|
|
119
|
+
await Promise.all(
|
|
120
|
+
articles.map((art) =>
|
|
121
|
+
got({
|
|
122
|
+
method: 'post',
|
|
123
|
+
url,
|
|
124
|
+
json: {
|
|
125
|
+
operationName: 'solutionDetailArticle',
|
|
126
|
+
query: `query solutionDetailArticle($slug: String!, $orderBy: SolutionArticleOrderBy!) {
|
|
127
|
+
solutionArticle(slug: $slug, orderBy: $orderBy) {
|
|
128
|
+
...solutionArticle
|
|
129
|
+
content
|
|
130
|
+
question {
|
|
131
|
+
questionTitleSlug
|
|
132
|
+
__typename
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
fragment solutionArticle on SolutionArticleNode {
|
|
137
|
+
uuid
|
|
138
|
+
title
|
|
139
|
+
slug
|
|
140
|
+
createdAt
|
|
141
|
+
thumbnail
|
|
142
|
+
author {
|
|
143
|
+
username
|
|
144
|
+
}
|
|
145
|
+
summary
|
|
146
|
+
}`,
|
|
147
|
+
variables: {
|
|
148
|
+
slug: art.node.slug,
|
|
149
|
+
orderBy: 'DEFAULT',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
headers,
|
|
153
|
+
})
|
|
154
|
+
)
|
|
155
|
+
)
|
|
156
|
+
).map((v) => v.data.data.solutionArticle);
|
|
157
|
+
const converter = new showdown.Converter();
|
|
158
|
+
const handleText = (s) => {
|
|
159
|
+
// 处理多语言代码展示问题
|
|
160
|
+
s = s.replace(/(```)([a-zA-Z0-9-+#]+)\s*?(\[.*?\])?\n/g, '\r\n###$2\r\n$1$2\r\n');
|
|
161
|
+
return s;
|
|
162
|
+
};
|
|
163
|
+
ctx.state.data = {
|
|
164
|
+
title: 'LeetCode 每日一题题解',
|
|
165
|
+
description: 'LeetCode 每日一题题解',
|
|
166
|
+
link: questionUrl,
|
|
167
|
+
item: [
|
|
168
|
+
{
|
|
169
|
+
title: `每日一题-${question.translatedTitle}${diffEmoji}`,
|
|
170
|
+
link: questionUrl,
|
|
171
|
+
description: question.translatedContent,
|
|
172
|
+
pubDate: timezone(parseDate(data.todayRecord[0].date), +8),
|
|
173
|
+
},
|
|
174
|
+
...articleContent.map((art, i) => ({
|
|
175
|
+
title: art.title,
|
|
176
|
+
link: `${questionUrl}/solution/${art.slug}`,
|
|
177
|
+
description: converter.makeHtml(handleText(art.content)),
|
|
178
|
+
pubDate: timezone(parseDate(articles[i].node.createdAt), +8),
|
|
179
|
+
author: art.author.username,
|
|
180
|
+
})),
|
|
181
|
+
],
|
|
182
|
+
};
|
|
183
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const showdown = require('showdown');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
module.exports = async (ctx) => {
|
|
7
|
+
const baseurl = `https://leetcode.com`;
|
|
8
|
+
const url = `${baseurl}/graphql/`;
|
|
9
|
+
const headers = {
|
|
10
|
+
'content-type': 'application/json',
|
|
11
|
+
};
|
|
12
|
+
const emoji = {
|
|
13
|
+
Medium: '🟡',
|
|
14
|
+
Easy: '🟢',
|
|
15
|
+
Hard: '🔴',
|
|
16
|
+
};
|
|
17
|
+
// 获取每日一题
|
|
18
|
+
const data = (
|
|
19
|
+
await got({
|
|
20
|
+
method: 'post',
|
|
21
|
+
url,
|
|
22
|
+
json: {
|
|
23
|
+
operationName: 'questionOfToday',
|
|
24
|
+
query: `query questionOfToday {
|
|
25
|
+
activeDailyCodingChallengeQuestion {
|
|
26
|
+
date
|
|
27
|
+
link
|
|
28
|
+
question {
|
|
29
|
+
frontendQuestionId: questionFrontendId
|
|
30
|
+
titleSlug
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}`,
|
|
34
|
+
variables: {},
|
|
35
|
+
},
|
|
36
|
+
headers,
|
|
37
|
+
})
|
|
38
|
+
).data.data;
|
|
39
|
+
const questionTitle = data.activeDailyCodingChallengeQuestion.question.titleSlug;
|
|
40
|
+
const questionUrl = `${baseurl}/problems/${questionTitle}/`;
|
|
41
|
+
|
|
42
|
+
// 获取题目内容
|
|
43
|
+
const question = (
|
|
44
|
+
await got({
|
|
45
|
+
method: 'post',
|
|
46
|
+
url,
|
|
47
|
+
json: {
|
|
48
|
+
operationName: 'questionData',
|
|
49
|
+
query: `query questionData($titleSlug: String!) {
|
|
50
|
+
question(titleSlug: $titleSlug) {
|
|
51
|
+
questionId
|
|
52
|
+
questionFrontendId
|
|
53
|
+
categoryTitle
|
|
54
|
+
boundTopicId
|
|
55
|
+
title
|
|
56
|
+
titleSlug
|
|
57
|
+
content
|
|
58
|
+
translatedTitle
|
|
59
|
+
translatedContent
|
|
60
|
+
isPaidOnly
|
|
61
|
+
difficulty
|
|
62
|
+
likes
|
|
63
|
+
}
|
|
64
|
+
}`,
|
|
65
|
+
variables: {
|
|
66
|
+
titleSlug: questionTitle,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
headers,
|
|
70
|
+
})
|
|
71
|
+
).data.data.question;
|
|
72
|
+
const diffEmoji = emoji[question.difficulty] || '';
|
|
73
|
+
// 获取题解(en网站仅一个题解)
|
|
74
|
+
const article = (
|
|
75
|
+
await got({
|
|
76
|
+
method: 'post',
|
|
77
|
+
url,
|
|
78
|
+
json: {
|
|
79
|
+
operationName: 'QuestionNote',
|
|
80
|
+
query: `query QuestionNote($titleSlug: String!) {
|
|
81
|
+
question(titleSlug: $titleSlug) {
|
|
82
|
+
questionId
|
|
83
|
+
article
|
|
84
|
+
solution {
|
|
85
|
+
id
|
|
86
|
+
content
|
|
87
|
+
contentTypeId
|
|
88
|
+
canSeeDetail
|
|
89
|
+
paidOnly
|
|
90
|
+
hasVideoSolution
|
|
91
|
+
paidOnlyVideo
|
|
92
|
+
rating {
|
|
93
|
+
id
|
|
94
|
+
count
|
|
95
|
+
average
|
|
96
|
+
userRating {
|
|
97
|
+
score
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}`,
|
|
103
|
+
variables: {
|
|
104
|
+
titleSlug: questionTitle,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
headers,
|
|
108
|
+
})
|
|
109
|
+
).data.data.question.solution;
|
|
110
|
+
if (article.content === null) {
|
|
111
|
+
article.content = 'Sorry, the solution of this question may be locked.';
|
|
112
|
+
}
|
|
113
|
+
const converter = new showdown.Converter();
|
|
114
|
+
// 图片处理
|
|
115
|
+
const parsePngSlide = async (s) => {
|
|
116
|
+
const pattern = /!\?!(.+)!\?!/;
|
|
117
|
+
if (!pattern.test(s)) {
|
|
118
|
+
return s;
|
|
119
|
+
}
|
|
120
|
+
const matched = s.match(new RegExp(pattern, 'g'));
|
|
121
|
+
const fn = async (m) => {
|
|
122
|
+
const relaurl = m.match(pattern)[1].split(':')[0];
|
|
123
|
+
const fullurl = path.resolve('/' + questionUrl + 'solution/', relaurl).slice(1);
|
|
124
|
+
const pngList = (
|
|
125
|
+
await got({
|
|
126
|
+
url: fullurl,
|
|
127
|
+
method: 'get',
|
|
128
|
+
headers,
|
|
129
|
+
})
|
|
130
|
+
).data.timeline;
|
|
131
|
+
return pngList.map((v) => `})`).join('\n');
|
|
132
|
+
};
|
|
133
|
+
const strs = await Promise.all(matched.map((v) => fn(v)));
|
|
134
|
+
for (let i = 0; i < matched.length; i++) {
|
|
135
|
+
s = s.replace(matched[i], strs[i]);
|
|
136
|
+
}
|
|
137
|
+
return s;
|
|
138
|
+
};
|
|
139
|
+
// iframe代码框处理
|
|
140
|
+
const parseIframe = async (s) => {
|
|
141
|
+
const pattern = new RegExp('<iframe.*? src=".*?playground/(.*?)/shared".*</iframe>');
|
|
142
|
+
if (!pattern.test(s)) {
|
|
143
|
+
return s;
|
|
144
|
+
}
|
|
145
|
+
const matched = s.match(new RegExp(pattern, 'g'));
|
|
146
|
+
const fn = async (m) => {
|
|
147
|
+
const uuid = m.match(pattern)[1];
|
|
148
|
+
const code = (
|
|
149
|
+
await got({
|
|
150
|
+
method: 'post',
|
|
151
|
+
url,
|
|
152
|
+
json: {
|
|
153
|
+
operationName: 'fetchPlayground',
|
|
154
|
+
query: `query fetchPlayground {
|
|
155
|
+
playground(uuid: "${uuid}") {
|
|
156
|
+
testcaseInput
|
|
157
|
+
name
|
|
158
|
+
isUserOwner
|
|
159
|
+
isLive
|
|
160
|
+
showRunCode
|
|
161
|
+
showOpenInPlayground
|
|
162
|
+
selectedLangSlug
|
|
163
|
+
isShared
|
|
164
|
+
__typename
|
|
165
|
+
}
|
|
166
|
+
allPlaygroundCodes(uuid: "${uuid}") {
|
|
167
|
+
code
|
|
168
|
+
langSlug
|
|
169
|
+
__typename
|
|
170
|
+
}
|
|
171
|
+
}`,
|
|
172
|
+
variables: {},
|
|
173
|
+
},
|
|
174
|
+
headers,
|
|
175
|
+
})
|
|
176
|
+
).data.data.allPlaygroundCodes;
|
|
177
|
+
return code.map((c) => `###${c.langSlug}\n\r \`\`\`${c.langSlug}\n ${c.code}\n\`\`\``).join('\n\r');
|
|
178
|
+
};
|
|
179
|
+
const strs = await Promise.all(matched.map((v) => fn(v)));
|
|
180
|
+
for (let i = 0; i < matched.length; i++) {
|
|
181
|
+
s = s.replace(matched[i], strs[i]);
|
|
182
|
+
}
|
|
183
|
+
return s;
|
|
184
|
+
};
|
|
185
|
+
const handleText = async (s) => {
|
|
186
|
+
// 处理代码iframe嵌入问题
|
|
187
|
+
s = await parseIframe(s);
|
|
188
|
+
// 处理图片展示问题
|
|
189
|
+
s = await parsePngSlide(s);
|
|
190
|
+
return s;
|
|
191
|
+
};
|
|
192
|
+
article.content = await handleText(article.content);
|
|
193
|
+
ctx.state.data = {
|
|
194
|
+
title: 'LeetCode DailyQuestion Solution',
|
|
195
|
+
description: 'LeetCode DailyQuestion Solution',
|
|
196
|
+
link: questionUrl,
|
|
197
|
+
item: [
|
|
198
|
+
{
|
|
199
|
+
title: `DailyQuestion-${question.title}${diffEmoji}`,
|
|
200
|
+
link: questionUrl,
|
|
201
|
+
description: question.content,
|
|
202
|
+
pubDate: timezone(parseDate(data.activeDailyCodingChallengeQuestion.date), +8),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
title: `Solution-${question.title}`,
|
|
206
|
+
link: `${questionUrl}solution/`,
|
|
207
|
+
description: converter.makeHtml(article.content),
|
|
208
|
+
pubDate: timezone(parseDate(data.activeDailyCodingChallengeQuestion.date), +8),
|
|
209
|
+
author: 'leetcode',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
};
|
package/lib/v2/leetcode/radar.js
CHANGED
|
@@ -24,6 +24,12 @@ module.exports = {
|
|
|
24
24
|
source: ['/'],
|
|
25
25
|
target: '/leetcode/dailyquestion/en',
|
|
26
26
|
},
|
|
27
|
+
{
|
|
28
|
+
title: '每日一题题解',
|
|
29
|
+
docs: 'https://docs.rsshub.app/programming.html#leetcode',
|
|
30
|
+
source: ['/'],
|
|
31
|
+
target: '/leetcode/dailyquestion/solution/en',
|
|
32
|
+
},
|
|
27
33
|
],
|
|
28
34
|
},
|
|
29
35
|
'leetcode.cn': {
|
|
@@ -45,6 +51,12 @@ module.exports = {
|
|
|
45
51
|
source: ['/'],
|
|
46
52
|
target: '/leetcode/dailyquestion/cn',
|
|
47
53
|
},
|
|
54
|
+
{
|
|
55
|
+
title: '每日一题题解',
|
|
56
|
+
docs: 'https://docs.rsshub.app/programming.html#leetcode',
|
|
57
|
+
source: ['/'],
|
|
58
|
+
target: '/leetcode/dailyquestion/solution/cn',
|
|
59
|
+
},
|
|
48
60
|
],
|
|
49
61
|
},
|
|
50
62
|
};
|
|
@@ -2,4 +2,6 @@ module.exports = function (router) {
|
|
|
2
2
|
router.get('/articles', require('./articles'));
|
|
3
3
|
router.get('/dailyquestion/cn', require('./dailyquestion-cn'));
|
|
4
4
|
router.get('/dailyquestion/en', require('./dailyquestion-en'));
|
|
5
|
+
router.get('/dailyquestion/solution/cn', require('./dailyquestion-solution-cn'));
|
|
6
|
+
router.get('/dailyquestion/solution/en', require('./dailyquestion-solution-en'));
|
|
5
7
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc);
|
|
6
|
+
|
|
7
|
+
module.exports = async (ctx) => {
|
|
8
|
+
const rootUrl = 'https://www.lovelive-anime.jp/news/';
|
|
9
|
+
|
|
10
|
+
const response = await got(rootUrl);
|
|
11
|
+
|
|
12
|
+
const $ = cheerio.load(response.data);
|
|
13
|
+
|
|
14
|
+
const pageFace = $('div.c-card.p-colum__box')
|
|
15
|
+
.map((_, item) => {
|
|
16
|
+
item = $(item);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
link: item.find('a.c-card__head').attr('href'),
|
|
20
|
+
pubDate: item.find('span.c-card__date').text(),
|
|
21
|
+
title: item.find('div.c-card__title').text(),
|
|
22
|
+
// description: `${item.find('div.c-card__title').text()}<br><img src="${item.find('a.c-card__head > div > figure > img').attr('src')}">`
|
|
23
|
+
description: renderDescription({
|
|
24
|
+
title: item.find('div.c-card__title').text(),
|
|
25
|
+
imglink: item.find('a.c-card__head > div > figure > img').attr('src'),
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
})
|
|
29
|
+
.get();
|
|
30
|
+
|
|
31
|
+
let items = pageFace;
|
|
32
|
+
|
|
33
|
+
if (ctx.params.option === 'detail') {
|
|
34
|
+
items = await Promise.all(
|
|
35
|
+
pageFace.map((item) =>
|
|
36
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
37
|
+
const detailResp = await got(item.link);
|
|
38
|
+
const $ = cheerio.load(detailResp.data);
|
|
39
|
+
|
|
40
|
+
const content = $('div.p-page__detail.p-article');
|
|
41
|
+
for (const v of content.find('img')) {
|
|
42
|
+
v.attribs.src = 'https://www.lovelive-anime.jp' + v.attribs.src;
|
|
43
|
+
}
|
|
44
|
+
item.description = content.html();
|
|
45
|
+
return item;
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ctx.state.data = {
|
|
52
|
+
title: 'lovelive official website news',
|
|
53
|
+
link: 'https://www.lovelive-anime.jp/news/',
|
|
54
|
+
item: items,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{title}}<br><img src="{{imglink}}">
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const rootUrl = 'https://www.macfilos.com';
|
|
7
|
+
const currentUrl = `${rootUrl}/blog`;
|
|
8
|
+
|
|
9
|
+
const response = await got({
|
|
10
|
+
method: 'get',
|
|
11
|
+
url: currentUrl,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const $ = cheerio.load(response.data);
|
|
15
|
+
|
|
16
|
+
let items = $('.entry-title a')
|
|
17
|
+
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 10)
|
|
18
|
+
.toArray()
|
|
19
|
+
.map((item) => {
|
|
20
|
+
item = $(item);
|
|
21
|
+
|
|
22
|
+
const parent = item.parent().parent();
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
title: item.text(),
|
|
26
|
+
link: item.attr('href'),
|
|
27
|
+
author: parent.find('.td-post-author-name a').text(),
|
|
28
|
+
pubDate: parseDate(parent.find('.td-post-date time').attr('datetime')),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
items = await Promise.all(
|
|
33
|
+
items.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const detailResponse = await got({
|
|
36
|
+
method: 'get',
|
|
37
|
+
url: item.link,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const content = cheerio.load(detailResponse.data);
|
|
41
|
+
|
|
42
|
+
content('hr').nextAll().remove();
|
|
43
|
+
content('hr').remove();
|
|
44
|
+
|
|
45
|
+
content('img').each(function () {
|
|
46
|
+
content(this).removeAttr('srcset');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
item.description = content('.td-post-content').html();
|
|
50
|
+
|
|
51
|
+
return item;
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
ctx.state.data = {
|
|
57
|
+
title: $('title').text(),
|
|
58
|
+
link: currentUrl,
|
|
59
|
+
item: items,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
const { baseUrl, getBoards, renderDesc } = require('./utils');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
let { board = 'all' } = ctx.params;
|
|
7
|
+
|
|
8
|
+
const boards = await getBoards(ctx.cache.tryGet);
|
|
9
|
+
let boardInfo;
|
|
10
|
+
if (board !== 'all') {
|
|
11
|
+
boardInfo = boards.find((b) => b.id === board || b.alias === board);
|
|
12
|
+
board = boardInfo.id;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { data: response } = await got.post(`${baseUrl}/article/get_new_articles`, {
|
|
16
|
+
json: {
|
|
17
|
+
boardId: board,
|
|
18
|
+
isCollege: false,
|
|
19
|
+
page: 0,
|
|
20
|
+
pageSize: ctx.query.limit ? Number(ctx.query.limit) : 30,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = JSON.parse(decodeURIComponent(response.result));
|
|
25
|
+
|
|
26
|
+
const items = await Promise.all(
|
|
27
|
+
result.map((item) =>
|
|
28
|
+
ctx.cache.tryGet(`meteor:${item.id}`, () => ({
|
|
29
|
+
title: item.title,
|
|
30
|
+
description: renderDesc(item.content),
|
|
31
|
+
link: `${baseUrl}/article/${item.shortId}`,
|
|
32
|
+
author: item.authorAlias,
|
|
33
|
+
pubDate: parseDate(item.createdAt),
|
|
34
|
+
}))
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
ctx.state.data = {
|
|
39
|
+
title: `${board !== 'all' ? boardInfo.title : '全部看板'} | Meteor 學生社群`,
|
|
40
|
+
description: board !== 'all' ? boardInfo.feedDescription : null,
|
|
41
|
+
image: board !== 'all' ? (boardInfo.imgUrl !== 'not_set' ? boardInfo.imgUrl : null) : null,
|
|
42
|
+
link: `${board !== 'all' ? boardInfo.link : `${baseUrl}/board/all`}/new`,
|
|
43
|
+
item: items,
|
|
44
|
+
};
|
|
45
|
+
};
|