rsshub 1.0.0-master.baeafb9 → 1.0.0-master.bb80a2e
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/README.md +4 -3
- package/lib/config.js +4 -0
- package/lib/middleware/cache/index.js +3 -3
- package/lib/middleware/cache/memory.js +5 -11
- package/lib/router.js +23 -22
- package/lib/routes/amd/graphicsdrivers.js +1 -1
- package/lib/routes/weibo/keyword.js +18 -10
- package/lib/routes/weibo/super_index.js +24 -15
- package/lib/routes/weibo/timeline.js +37 -14
- package/lib/routes/weibo/user.js +42 -18
- package/lib/routes/weibo/utils.js +39 -0
- package/lib/utils/parse-date.js +171 -17
- package/lib/utils/torrent.js +9 -1
- package/lib/v2/asus/bios.js +38 -0
- package/lib/v2/asus/maintainer.js +3 -0
- package/lib/v2/asus/radar.js +13 -0
- package/lib/v2/asus/router.js +3 -0
- package/lib/v2/asus/templates/bios.art +6 -0
- package/lib/v2/douban/people/status.js +10 -2
- package/lib/v2/douban/people/wish.js +55 -43
- package/lib/v2/gov/anhui/kjt.js +56 -0
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/radar.js +90 -76
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/hupu/all.js +73 -0
- package/lib/v2/hupu/bbs.js +64 -0
- package/lib/v2/hupu/index.js +72 -0
- package/lib/v2/hupu/maintainer.js +7 -0
- package/lib/v2/hupu/radar.js +35 -0
- package/lib/v2/hupu/router.js +7 -0
- package/lib/v2/hupu/templates/description.art +6 -0
- package/lib/{routes → v2}/ifeng/feng.js +7 -5
- package/lib/v2/ifeng/maintainer.js +3 -0
- package/lib/v2/ifeng/radar.js +11 -0
- package/lib/v2/ifeng/router.js +3 -0
- package/lib/{routes → v2}/ifeng/utils.js +0 -0
- package/lib/v2/kakuyomu/episode.js +54 -0
- package/lib/v2/kakuyomu/maintainer.js +3 -0
- package/lib/v2/kakuyomu/radar.js +13 -0
- package/lib/v2/kakuyomu/router.js +1 -0
- package/lib/v2/mihoyo/bbs.js +62 -0
- package/lib/v2/mihoyo/maintainer.js +3 -0
- package/lib/v2/mihoyo/radar.js +31 -0
- package/lib/v2/mihoyo/router.js +3 -0
- package/lib/v2/mihoyo/templates/description.art +6 -0
- package/lib/{routes → v2}/mpaypass/main.js +23 -27
- package/lib/v2/mpaypass/maintainer.js +4 -0
- package/lib/v2/mpaypass/news.js +39 -0
- package/lib/v2/mpaypass/radar.js +19 -0
- package/lib/v2/mpaypass/router.js +4 -0
- package/lib/v2/natgeo/dailyphoto.js +32 -0
- package/lib/v2/natgeo/dailyselection.js +41 -0
- package/lib/v2/natgeo/maintainer.js +5 -0
- package/lib/{routes → v2}/natgeo/natgeo.js +18 -32
- package/lib/v2/natgeo/radar.js +24 -0
- package/lib/v2/natgeo/router.js +5 -0
- package/lib/v2/natgeo/templates/dailyPhoto.art +5 -0
- package/lib/v2/nuaa/cs/index.js +87 -0
- package/lib/v2/nuaa/jwc/jwc.js +82 -0
- package/lib/v2/nuaa/maintainer.js +5 -0
- package/lib/v2/nuaa/radar.js +23 -0
- package/lib/v2/nuaa/router.js +5 -0
- package/lib/{routes/universities → v2}/nuaa/utils/pypasswaf.js +1 -1
- package/lib/{routes/universities → v2}/nuaa/yjsy/yjsy.js +16 -22
- package/lib/v2/picuki/profile.js +12 -3
- package/lib/v2/pubmed/maintainer.js +3 -0
- package/lib/v2/pubmed/radar.js +13 -0
- package/lib/v2/pubmed/router.js +3 -0
- package/lib/v2/pubmed/templates/description.art +7 -0
- package/lib/v2/pubmed/trending.js +58 -0
- package/lib/v2/qweather/3days.js +46 -0
- package/lib/v2/qweather/maintainer.js +4 -0
- package/lib/v2/qweather/now.js +46 -0
- package/lib/v2/qweather/router.js +4 -0
- package/lib/v2/qweather/util/3days.art +20 -0
- package/lib/v2/qweather/util/now.art +16 -0
- package/lib/v2/telegram/channel.js +10 -6
- package/lib/v2/test/index.js +1 -1
- package/lib/{routes → v2}/thepaper/839studio/category.js +0 -0
- package/lib/{routes → v2}/thepaper/839studio/studio.js +0 -0
- package/lib/{routes → v2}/thepaper/channel.js +0 -0
- package/lib/v2/thepaper/factpaper.js +61 -0
- package/lib/{routes → v2}/thepaper/featured.js +0 -0
- package/lib/{routes → v2}/thepaper/list.js +0 -0
- package/lib/v2/thepaper/maintainer.js +8 -0
- package/lib/v2/thepaper/radar.js +42 -0
- package/lib/v2/thepaper/router.js +8 -0
- package/lib/v2/thepaper/templates/factpaper.art +12 -0
- package/lib/v2/thepaper/utils.js +55 -0
- package/lib/v2/zooTeam/blog.js +32 -0
- package/lib/v2/zooTeam/maintainer.js +4 -0
- package/lib/v2/zooTeam/radar.js +21 -0
- package/lib/v2/zooTeam/router.js +4 -0
- package/lib/v2/zooTeam/weekly.js +34 -0
- package/package.json +12 -8
- package/lib/routes/hupu/all.js +0 -53
- package/lib/routes/hupu/bbs.js +0 -83
- package/lib/routes/hupu/dept.js +0 -66
- package/lib/routes/mpaypass/news.js +0 -43
- package/lib/routes/natgeo/dailyphoto.js +0 -27
- package/lib/routes/pubmed/trending.js +0 -65
- package/lib/routes/thepaper/utils.js +0 -48
- package/lib/routes/universities/nuaa/cs/index.js +0 -84
- package/lib/routes/universities/nuaa/jwc/jwc.js +0 -105
package/lib/v2/gov/radar.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
'ah.gov.cn': {
|
|
3
|
+
_name: '安徽省科技厅',
|
|
4
|
+
kjt: [
|
|
5
|
+
{
|
|
6
|
+
title: '科技资讯',
|
|
7
|
+
docs: 'https://docs.rsshub.app/government.html#an-hui-sheng-ke-ji-ting-ke-ji-zi-xun',
|
|
8
|
+
source: ['/*'],
|
|
9
|
+
target: (params, url) => `/gov/anhui/kjt${new URL(url).href.match(/kjt\.ah\.gov\.cn(.*)\/index.html/)[1] ?? ''}`,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '科技资源',
|
|
13
|
+
docs: 'https://docs.rsshub.app/government.html#an-hui-sheng-ke-ji-ting-ke-ji-zi-yuan',
|
|
14
|
+
source: ['/*'],
|
|
15
|
+
target: (params, url) => `/gov/anhui/kjt${new URL(url).href.match(/kjt\.ah\.gov\.cn(.*)\/index.html/)[1] ?? ''}`,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
2
19
|
'beijing.gov.cn': {
|
|
3
20
|
_name: '北京市人民政府',
|
|
4
21
|
kw: [
|
|
@@ -272,61 +289,14 @@ module.exports = {
|
|
|
272
289
|
},
|
|
273
290
|
],
|
|
274
291
|
},
|
|
275
|
-
'
|
|
276
|
-
_name: '
|
|
292
|
+
'deyang.gov.cn': {
|
|
293
|
+
_name: '德阳市人民政府',
|
|
277
294
|
'.': [
|
|
278
295
|
{
|
|
279
|
-
title: '
|
|
280
|
-
docs: 'https://docs.rsshub.app/government.html#
|
|
281
|
-
source: ['/*'],
|
|
282
|
-
target: '/gov/shenzhen/hrss/szksy/:caty/:page?',
|
|
283
|
-
},
|
|
284
|
-
],
|
|
285
|
-
},
|
|
286
|
-
'zzb.sz.gov.cn': {
|
|
287
|
-
_name: '深圳组工在线',
|
|
288
|
-
www: [
|
|
289
|
-
{
|
|
290
|
-
title: '公告',
|
|
291
|
-
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan',
|
|
296
|
+
title: '德阳市政府公开信息',
|
|
297
|
+
docs: 'https://docs.rsshub.app/government.html#de-yang-shi-fu-ren-min-zheng-zheng-fu',
|
|
292
298
|
source: ['/*'],
|
|
293
|
-
target: '/
|
|
294
|
-
},
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
'sh.gov.cn': {
|
|
298
|
-
_name: '上海市人民政府',
|
|
299
|
-
wsjkw: [
|
|
300
|
-
{
|
|
301
|
-
title: '上海卫健委 疫情通报',
|
|
302
|
-
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai-yi-qing-tong-bao-shang-hai-wei-jian-wei',
|
|
303
|
-
source: ['/'],
|
|
304
|
-
target: '/gov/shanghai/wsjkw/yqtb',
|
|
305
|
-
},
|
|
306
|
-
],
|
|
307
|
-
rsj: [
|
|
308
|
-
{
|
|
309
|
-
title: '上海市职业能力考试院 考试项目',
|
|
310
|
-
docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-zhi-ye-neng-li-kao-shi-yuan-kao-shi-xiang-mu',
|
|
311
|
-
source: ['/'],
|
|
312
|
-
target: '/gov/shanghai/rsj/ksxm',
|
|
313
|
-
},
|
|
314
|
-
],
|
|
315
|
-
},
|
|
316
|
-
'tqyb.com.cn': {
|
|
317
|
-
_name: '广州天气',
|
|
318
|
-
www: [
|
|
319
|
-
{
|
|
320
|
-
title: '突发性天气提示',
|
|
321
|
-
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi',
|
|
322
|
-
source: ['/gz/weatherAlarm/suddenWeather/'],
|
|
323
|
-
target: '/gov/guangdong/tqyb/tfxtq',
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
title: '广东省内城市预警信号',
|
|
327
|
-
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao',
|
|
328
|
-
source: ['/gz/weatherAlarm/otherCity/'],
|
|
329
|
-
target: '/gov/guangdong/tqyb/sncsyjxh',
|
|
299
|
+
target: '/sichuan/deyang/govpulicinfo/:countyName/:institutionName?',
|
|
330
300
|
},
|
|
331
301
|
],
|
|
332
302
|
},
|
|
@@ -365,14 +335,25 @@ module.exports = {
|
|
|
365
335
|
},
|
|
366
336
|
],
|
|
367
337
|
},
|
|
368
|
-
'
|
|
369
|
-
_name: '
|
|
370
|
-
|
|
338
|
+
'mee.gov.cn': {
|
|
339
|
+
_name: '生态环境部',
|
|
340
|
+
www: [
|
|
371
341
|
{
|
|
372
|
-
title: '
|
|
373
|
-
docs: 'https://docs.rsshub.app/government.html#
|
|
374
|
-
source: ['
|
|
375
|
-
target: '/
|
|
342
|
+
title: '要闻动态',
|
|
343
|
+
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-sheng-tai-huan-jing-bu',
|
|
344
|
+
source: ['/ywdt/:category'],
|
|
345
|
+
target: '/gov/mee/ywdt/:category',
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
},
|
|
349
|
+
'mfa.gov.cn': {
|
|
350
|
+
_name: '中华人民共和国外交部',
|
|
351
|
+
www: [
|
|
352
|
+
{
|
|
353
|
+
title: '外交动态',
|
|
354
|
+
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-wai-jiao-bu-wai-jiao-dong-tai',
|
|
355
|
+
source: ['/web/wjdt_674879/:category'],
|
|
356
|
+
target: (params) => `/gov/mfa/wjdt/${params.category.split('_')[0]}`,
|
|
376
357
|
},
|
|
377
358
|
],
|
|
378
359
|
},
|
|
@@ -393,17 +374,6 @@ module.exports = {
|
|
|
393
374
|
},
|
|
394
375
|
],
|
|
395
376
|
},
|
|
396
|
-
'mee.gov.cn': {
|
|
397
|
-
_name: '生态环境部',
|
|
398
|
-
www: [
|
|
399
|
-
{
|
|
400
|
-
title: '要闻动态',
|
|
401
|
-
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-sheng-tai-huan-jing-bu',
|
|
402
|
-
source: ['/ywdt/:category'],
|
|
403
|
-
target: '/gov/mee/ywdt/:category',
|
|
404
|
-
},
|
|
405
|
-
],
|
|
406
|
-
},
|
|
407
377
|
'pbc.gov.cn': {
|
|
408
378
|
_name: '中国人民银行',
|
|
409
379
|
'.': [
|
|
@@ -433,14 +403,58 @@ module.exports = {
|
|
|
433
403
|
},
|
|
434
404
|
],
|
|
435
405
|
},
|
|
436
|
-
'
|
|
437
|
-
_name: '
|
|
406
|
+
'sh.gov.cn': {
|
|
407
|
+
_name: '上海市人民政府',
|
|
408
|
+
wsjkw: [
|
|
409
|
+
{
|
|
410
|
+
title: '上海卫健委 疫情通报',
|
|
411
|
+
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai-yi-qing-tong-bao-shang-hai-wei-jian-wei',
|
|
412
|
+
source: ['/'],
|
|
413
|
+
target: '/gov/shanghai/wsjkw/yqtb',
|
|
414
|
+
},
|
|
415
|
+
],
|
|
416
|
+
rsj: [
|
|
417
|
+
{
|
|
418
|
+
title: '上海市职业能力考试院 考试项目',
|
|
419
|
+
docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-zhi-ye-neng-li-kao-shi-yuan-kao-shi-xiang-mu',
|
|
420
|
+
source: ['/'],
|
|
421
|
+
target: '/gov/shanghai/rsj/ksxm',
|
|
422
|
+
},
|
|
423
|
+
],
|
|
424
|
+
},
|
|
425
|
+
'sz.gov.cn': {
|
|
426
|
+
_name: '深圳政府在线移动门户',
|
|
427
|
+
hrss: [
|
|
428
|
+
{
|
|
429
|
+
title: '考试院公告',
|
|
430
|
+
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-wei-zu-zhi-bu',
|
|
431
|
+
source: ['/*'],
|
|
432
|
+
target: '/gov/shenzhen/hrss/szksy/:caty/:page?',
|
|
433
|
+
},
|
|
434
|
+
],
|
|
435
|
+
zzb: [
|
|
436
|
+
{
|
|
437
|
+
title: '组工在线公告',
|
|
438
|
+
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan',
|
|
439
|
+
source: ['/*'],
|
|
440
|
+
target: '/gov/shenzhen/zzb/:caty/:page?',
|
|
441
|
+
},
|
|
442
|
+
],
|
|
443
|
+
},
|
|
444
|
+
'tqyb.com.cn': {
|
|
445
|
+
_name: '广州天气',
|
|
438
446
|
www: [
|
|
439
447
|
{
|
|
440
|
-
title: '
|
|
441
|
-
docs: 'https://docs.rsshub.app/government.html#
|
|
442
|
-
source: ['/
|
|
443
|
-
target:
|
|
448
|
+
title: '突发性天气提示',
|
|
449
|
+
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi',
|
|
450
|
+
source: ['/gz/weatherAlarm/suddenWeather/'],
|
|
451
|
+
target: '/gov/guangdong/tqyb/tfxtq',
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
title: '广东省内城市预警信号',
|
|
455
|
+
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao',
|
|
456
|
+
source: ['/gz/weatherAlarm/otherCity/'],
|
|
457
|
+
target: '/gov/guangdong/tqyb/sncsyjxh',
|
|
444
458
|
},
|
|
445
459
|
],
|
|
446
460
|
},
|
package/lib/v2/gov/router.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
module.exports = function (router) {
|
|
2
|
+
router.get(/anhui\/kjt\/([\w\d/-]+)?/, require('./anhui/kjt'));
|
|
2
3
|
router.get('/beijing/kw/:channel', require('./beijing/kw/index'));
|
|
3
4
|
router.get('/shenzhen/hrss/szksy/:caty/:page?', require('./shenzhen/hrss/szksy/index'));
|
|
4
5
|
router.get('/shenzhen/zzb/:caty/:page?', require('./shenzhen/zzb/index'));
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { parseDate, parseRelativeDate } = require('@/utils/parse-date');
|
|
5
|
+
const { art } = require('@/utils/render');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
module.exports = async (ctx) => {
|
|
9
|
+
const id = ctx.params.id ?? 'topic-daily';
|
|
10
|
+
|
|
11
|
+
const rootUrl = 'https://bbs.hupu.com';
|
|
12
|
+
const currentUrl = `${rootUrl}/${id}`;
|
|
13
|
+
|
|
14
|
+
const response = await got({
|
|
15
|
+
method: 'get',
|
|
16
|
+
url: currentUrl,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const $ = cheerio.load(response.data);
|
|
20
|
+
|
|
21
|
+
let items = $('div.t-info > a, a.p-title')
|
|
22
|
+
.toArray()
|
|
23
|
+
.map((item) => {
|
|
24
|
+
item = $(item);
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
title: item.text(),
|
|
28
|
+
link: `https://m.hupu.com/bbs${item.attr('href')}`,
|
|
29
|
+
pubDate: timezone(parseDate(item.parent().parent().find('.post-time').text(), 'MM-DD HH:mm'), +8),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
items = await Promise.all(
|
|
34
|
+
items.map((item) =>
|
|
35
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
36
|
+
try {
|
|
37
|
+
const detailResponse = await got({
|
|
38
|
+
method: 'get',
|
|
39
|
+
url: item.link,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const content = cheerio.load(detailResponse.data);
|
|
43
|
+
|
|
44
|
+
const videos = [];
|
|
45
|
+
|
|
46
|
+
content('.thread-video-wrap').each(function () {
|
|
47
|
+
videos.push(content('video').attr('src'));
|
|
48
|
+
content(this).remove();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
content('.bbs-user-info-time span').remove();
|
|
52
|
+
|
|
53
|
+
item.author = content('.bbs-user-info-name').first().text();
|
|
54
|
+
item.pubDate = item.pubDate ?? timezone(parseRelativeDate(content('.bbs-user-info-time').first().text()), +8);
|
|
55
|
+
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
56
|
+
videos,
|
|
57
|
+
description: content('.bbs-thread-content').html(),
|
|
58
|
+
});
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// no-empty
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return item;
|
|
64
|
+
})
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
ctx.state.data = {
|
|
69
|
+
title: `虎扑社区 - ${$('.middle-title, .bbs-sl-web-intro-detail-title').text()}`,
|
|
70
|
+
link: currentUrl,
|
|
71
|
+
item: items,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { parseRelativeDate } = require('@/utils/parse-date');
|
|
5
|
+
const { art } = require('@/utils/render');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
module.exports = async (ctx) => {
|
|
9
|
+
const id = ctx.params.id ?? '34';
|
|
10
|
+
const order = ctx.params.order ?? '1';
|
|
11
|
+
|
|
12
|
+
const rootUrl = 'https://m.hupu.com';
|
|
13
|
+
const currentUrl = `${rootUrl}/api/v1/bbs-forumthreadlist-frontend/${id}-1?postdate=${order}`;
|
|
14
|
+
|
|
15
|
+
const response = await got({
|
|
16
|
+
method: 'get',
|
|
17
|
+
url: currentUrl,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
let items = response.data.data.t_list.map((item) => ({
|
|
21
|
+
title: item.title,
|
|
22
|
+
link: `${rootUrl}/bbs/${item.tid}.html`,
|
|
23
|
+
pubDate: timezone(parseRelativeDate(item.t_post), +8),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
items = await Promise.all(
|
|
27
|
+
items.map((item) =>
|
|
28
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
29
|
+
try {
|
|
30
|
+
const detailResponse = await got({
|
|
31
|
+
method: 'get',
|
|
32
|
+
url: item.link,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const content = cheerio.load(detailResponse.data);
|
|
36
|
+
|
|
37
|
+
const videos = [];
|
|
38
|
+
|
|
39
|
+
content('.thread-video-wrap').each(function () {
|
|
40
|
+
videos.push(content('video').attr('src'));
|
|
41
|
+
content(this).remove();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
item.author = content('.bbs-user-info-name').first().text();
|
|
45
|
+
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
46
|
+
videos,
|
|
47
|
+
description: content('#bbs-thread-content').html(),
|
|
48
|
+
});
|
|
49
|
+
} catch (e) {
|
|
50
|
+
// no-empty
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return item;
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
ctx.state.data = {
|
|
59
|
+
title: `虎扑社区 - ${response.data.data.keywords}`,
|
|
60
|
+
link: currentUrl,
|
|
61
|
+
item: items,
|
|
62
|
+
description: response.data.data.description,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
|
|
6
|
+
const categories = {
|
|
7
|
+
nba: {
|
|
8
|
+
title: 'NBA',
|
|
9
|
+
data: 'news',
|
|
10
|
+
},
|
|
11
|
+
cba: {
|
|
12
|
+
title: 'CBA',
|
|
13
|
+
data: 'news',
|
|
14
|
+
},
|
|
15
|
+
soccer: {
|
|
16
|
+
title: '足球',
|
|
17
|
+
data: 'soccerIndexData',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = async (ctx) => {
|
|
22
|
+
const category = ctx.params.category ?? 'soccer';
|
|
23
|
+
|
|
24
|
+
const rootUrl = 'https://m.hupu.com';
|
|
25
|
+
const currentUrl = `${rootUrl}/${category}`;
|
|
26
|
+
|
|
27
|
+
const response = await got({
|
|
28
|
+
method: 'get',
|
|
29
|
+
url: currentUrl,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const data = JSON.parse(response.data.match(/"pageProps":(.*)},"page":"\//)[1]);
|
|
33
|
+
|
|
34
|
+
let items = data[categories[category].data].map((item) => ({
|
|
35
|
+
title: item.title,
|
|
36
|
+
pubDate: timezone(parseDate(item.publishTime), +8),
|
|
37
|
+
link: item.link.replace(/bbs\.hupu.com/, 'm.hupu.com/bbs'),
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
items = await Promise.all(
|
|
41
|
+
items
|
|
42
|
+
.filter((item) => !/subject/.test(item.link))
|
|
43
|
+
.map((item) =>
|
|
44
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
45
|
+
try {
|
|
46
|
+
const detailResponse = await got({
|
|
47
|
+
method: 'get',
|
|
48
|
+
url: item.link,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const content = cheerio.load(detailResponse.data);
|
|
52
|
+
|
|
53
|
+
item.author = content('.bbs-user-info-name').text();
|
|
54
|
+
item.description = content('#bbs-thread-content').html();
|
|
55
|
+
item.category = content('.bbs-link')
|
|
56
|
+
.toArray()
|
|
57
|
+
.map((c) => content(c).text());
|
|
58
|
+
} catch (e) {
|
|
59
|
+
// no-empty
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return item;
|
|
63
|
+
})
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
ctx.state.data = {
|
|
68
|
+
title: `虎扑 - ${categories[category].title}`,
|
|
69
|
+
link: currentUrl,
|
|
70
|
+
item: items,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'hupu.com': {
|
|
3
|
+
_name: '虎扑',
|
|
4
|
+
'': [
|
|
5
|
+
{
|
|
6
|
+
title: '首页',
|
|
7
|
+
docs: 'https://docs.rsshub.app/bbs.html#hu-pu-shou-ye',
|
|
8
|
+
source: ['/:category', '/'],
|
|
9
|
+
target: '/hupu/:category',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
bbs: [
|
|
13
|
+
{
|
|
14
|
+
title: '热帖',
|
|
15
|
+
docs: 'https://docs.rsshub.app/bbs.html#hu-pu-re-tie',
|
|
16
|
+
source: ['/:id'],
|
|
17
|
+
target: '/hupu/all/:id',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
m: [
|
|
21
|
+
{
|
|
22
|
+
title: '首页',
|
|
23
|
+
docs: 'https://docs.rsshub.app/bbs.html#hu-pu-shou-ye',
|
|
24
|
+
source: ['/:category', '/'],
|
|
25
|
+
target: '/hupu/:category',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: '社区',
|
|
29
|
+
docs: 'https://docs.rsshub.app/bbs.html#hu-pu-she-qu',
|
|
30
|
+
source: ['/bbs/:id', '/'],
|
|
31
|
+
target: '/hupu/bbs/:id/:order',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module.exports = function (router) {
|
|
2
|
+
router.get('/all/:id?', require('./all'));
|
|
3
|
+
router.get('/bbs/:id?/:order?', require('./bbs'));
|
|
4
|
+
router.get('/bxj/:id?/:order?', require('./bbs'));
|
|
5
|
+
router.get('/dept/:category?', require('./index'));
|
|
6
|
+
router.get('/:category?', require('./index'));
|
|
7
|
+
};
|
|
@@ -2,6 +2,8 @@ const got = require('@/utils/got');
|
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const { JSDOM } = require('jsdom');
|
|
4
4
|
const utils = require('./utils');
|
|
5
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
6
|
+
const timezone = require('@/utils/timezone');
|
|
5
7
|
|
|
6
8
|
module.exports = async (ctx) => {
|
|
7
9
|
const id = ctx.params.id;
|
|
@@ -15,14 +17,14 @@ module.exports = async (ctx) => {
|
|
|
15
17
|
});
|
|
16
18
|
const contentResponse = await got({
|
|
17
19
|
method: 'get',
|
|
18
|
-
url: `https://shankapi.ifeng.com/
|
|
20
|
+
url: `https://shankapi.ifeng.com/season/ishare/getShareListData/${id}/${type}/1/ifengnewsh5/getListData`,
|
|
19
21
|
headers: {
|
|
20
22
|
Referer: `https://feng.ifeng.com/author/${id}`,
|
|
21
23
|
},
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
const userData = userResponse.data.data.data;
|
|
25
|
-
const contentData = contentResponse.data.data;
|
|
27
|
+
const contentData = JSON.parse(contentResponse.data.match(/"data":(\[(.*?)\])/)[1]);
|
|
26
28
|
|
|
27
29
|
const mediaName = userData.weMediaName;
|
|
28
30
|
const items = await Promise.all(
|
|
@@ -31,13 +33,13 @@ module.exports = async (ctx) => {
|
|
|
31
33
|
const simple = {
|
|
32
34
|
title: item.title,
|
|
33
35
|
description: `<img src="${item.thumbnail}">${item.title}`,
|
|
34
|
-
pubDate:
|
|
36
|
+
pubDate: timezone(parseDate(item.newsTime), +8),
|
|
35
37
|
author: mediaName,
|
|
36
38
|
link,
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const details = await ctx.cache.tryGet(`ifeng:feng:${link}`, async () => {
|
|
40
|
-
const response = await got
|
|
42
|
+
const response = await got(link);
|
|
41
43
|
const $ = cheerio.load(response.data);
|
|
42
44
|
if (type === 'doc') {
|
|
43
45
|
const dom = new JSDOM(`<body><script>${$('[async] + script').html()}</script></body>`, {
|
|
@@ -57,7 +59,7 @@ module.exports = async (ctx) => {
|
|
|
57
59
|
description: $('meta[name=description]').attr('content'),
|
|
58
60
|
};
|
|
59
61
|
});
|
|
60
|
-
return
|
|
62
|
+
return { ...simple, ...details };
|
|
61
63
|
})
|
|
62
64
|
);
|
|
63
65
|
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
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 id = ctx.params.id;
|
|
7
|
+
const limit = parseInt(ctx.query.limit) || 5;
|
|
8
|
+
const work_url = `https://kakuyomu.jp/works/${id}`;
|
|
9
|
+
const $ = cheerio.load(await get(work_url));
|
|
10
|
+
|
|
11
|
+
const work_title = $('#workTitle').text();
|
|
12
|
+
const introduction = $('#introduction').text();
|
|
13
|
+
|
|
14
|
+
const episode_list = $('a.widget-toc-episode-episodeTitle')
|
|
15
|
+
.map((_, episode) => {
|
|
16
|
+
const $_episode = $(episode);
|
|
17
|
+
return {
|
|
18
|
+
title: $_episode.find('span').text(),
|
|
19
|
+
link: $_episode.attr('href'),
|
|
20
|
+
pubDate: parseDate($_episode.find('time').attr('datetime')),
|
|
21
|
+
};
|
|
22
|
+
})
|
|
23
|
+
.toArray()
|
|
24
|
+
.sort((a, b) => (a.pubDate <= b.pubDate ? 1 : -1))
|
|
25
|
+
.slice(0, limit);
|
|
26
|
+
|
|
27
|
+
const item_list = await Promise.all(
|
|
28
|
+
episode_list.map((episode) =>
|
|
29
|
+
ctx.cache.tryGet(episode.link, async () => {
|
|
30
|
+
episode.link = `https://kakuyomu.jp${episode.link}`;
|
|
31
|
+
const content = cheerio.load(await get(episode.link));
|
|
32
|
+
episode.description = content('.widget-episodeBody').html();
|
|
33
|
+
return episode;
|
|
34
|
+
})
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
ctx.state.data = {
|
|
39
|
+
title: work_title,
|
|
40
|
+
link: work_url,
|
|
41
|
+
description: introduction,
|
|
42
|
+
language: 'ja',
|
|
43
|
+
item: item_list,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const get = async (url) => {
|
|
48
|
+
const response = await got({
|
|
49
|
+
method: 'get',
|
|
50
|
+
url,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return response.data;
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = (router) => router.get('/episode/:id', require('./episode.js'));
|