rsshub 1.0.0-master.c034cfb → 1.0.0-master.c05524b
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/router.js +7 -7
- package/lib/utils/rand-user-agent.js +2 -1
- package/lib/v2/2048/index.js +18 -13
- package/lib/v2/abc/index.js +162 -0
- package/lib/v2/abc/maintainer.js +3 -0
- package/lib/v2/abc/radar.js +13 -0
- package/lib/v2/abc/router.js +3 -0
- package/lib/v2/abc/templates/description.art +21 -0
- package/lib/v2/apnews/topics.js +1 -0
- package/lib/v2/apple/apps.js +88 -17
- package/lib/v2/apple/maintainer.js +1 -1
- package/lib/v2/apple/radar.js +3 -3
- package/lib/v2/apple/router.js +1 -1
- package/lib/v2/asiantolick/index.js +73 -27
- package/lib/v2/asiantolick/maintainer.js +5 -3
- package/lib/v2/asiantolick/radar.js +34 -12
- package/lib/v2/asiantolick/router.js +2 -2
- package/lib/v2/asiantolick/templates/description.art +9 -3
- package/lib/v2/bilibili/fav.js +2 -0
- package/lib/v2/bilibili/userFav.js +2 -0
- package/lib/v2/booru/maintainer.js +3 -0
- package/lib/v2/booru/mmda.js +47 -0
- package/lib/v2/booru/radar.js +12 -0
- package/lib/v2/booru/router.js +3 -0
- package/lib/v2/caixinglobal/latest.js +64 -0
- package/lib/v2/caixinglobal/maintainer.js +3 -0
- package/lib/v2/caixinglobal/radar.js +13 -0
- package/lib/v2/caixinglobal/router.js +3 -0
- package/lib/v2/china/finance/finance.js +61 -0
- package/lib/v2/china/maintainer.js +1 -0
- package/lib/v2/china/news/military/news.js +5 -6
- package/lib/v2/china/radar.js +9 -0
- package/lib/v2/china/router.js +1 -0
- package/lib/v2/cna/index.js +1 -0
- package/lib/v2/farmatters/index.js +85 -0
- package/lib/v2/farmatters/maintainer.js +7 -0
- package/lib/v2/farmatters/radar.js +36 -0
- package/lib/v2/farmatters/router.js +6 -0
- package/lib/v2/farmatters/templates/description.art +9 -0
- package/lib/v2/gcores/category.js +1 -0
- package/lib/v2/gcores/radio.js +1 -0
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/npc/index.js +47 -0
- package/lib/v2/gov/radar.js +11 -0
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/grubstreet/maintainer.js +4 -0
- package/lib/v2/grubstreet/radar.js +13 -0
- package/lib/v2/grubstreet/router.js +3 -0
- package/lib/v2/grubstreet/utils.js +84 -0
- package/lib/v2/javbus/index.js +6 -0
- package/lib/v2/metacritic/index.js +121 -0
- package/lib/v2/metacritic/maintainer.js +5 -0
- package/lib/v2/metacritic/radar.js +43 -0
- package/lib/v2/metacritic/router.js +3 -0
- package/lib/v2/metacritic/templates/description.art +19 -0
- package/lib/v2/metacritic/util.js +42 -0
- package/lib/v2/mymusicsheet/maintainer.js +3 -0
- package/lib/v2/mymusicsheet/radar.js +13 -0
- package/lib/v2/mymusicsheet/router.js +3 -0
- package/lib/v2/mymusicsheet/templates/description.art +41 -0
- package/lib/v2/mymusicsheet/usersheets.js +120 -0
- package/lib/v2/netflav/index.js +39 -0
- package/lib/v2/netflav/maintainer.js +4 -0
- package/lib/v2/netflav/radar.js +13 -0
- package/lib/v2/netflav/router.js +3 -0
- package/lib/v2/netflav/templates/description.art +8 -0
- package/lib/v2/npr/radar.js +2 -2
- package/lib/v2/paulgraham/article.js +62 -0
- package/lib/v2/paulgraham/maintainer.js +3 -0
- package/lib/v2/paulgraham/radar.js +13 -0
- package/lib/v2/paulgraham/router.js +5 -0
- package/lib/v2/pixiv/user.js +2 -1
- package/lib/v2/pixiv/utils.js +2 -2
- package/lib/v2/rfi/maintainer.js +1 -1
- package/lib/v2/rfi/news.js +35 -22
- package/lib/v2/rfi/radar.js +5 -5
- package/lib/v2/rfi/router.js +1 -1
- package/lib/v2/scau/maintainer.js +1 -0
- package/lib/v2/scau/radar.js +8 -0
- package/lib/v2/scau/router.js +1 -0
- package/lib/v2/scau/yjs.js +2 -2
- package/lib/v2/scau/yjsy.js +27 -0
- package/lib/v2/tesla/cx.js +119 -0
- package/lib/v2/tesla/maintainer.js +1 -0
- package/lib/v2/tesla/radar.js +13 -1
- package/lib/v2/tesla/router.js +1 -0
- package/lib/v2/tesla/templates/description.art +140 -0
- package/lib/v2/thepaper/featured.js +1 -1
- package/lib/v2/thepaper/utils.js +18 -12
- package/lib/v2/twitch/live.js +88 -0
- package/lib/v2/twitch/maintainer.js +5 -0
- package/lib/v2/twitch/radar.js +37 -0
- package/lib/v2/twitch/router.js +5 -0
- package/lib/v2/twitch/schedule.js +75 -0
- package/lib/v2/twitch/video.js +64 -0
- package/lib/v2/udn/breaking-news.js +6 -2
- package/lib/v2/weibo/oasis/user.js +4 -3
- package/lib/v2/whu/hyxt.js +50 -0
- package/lib/v2/whu/maintainer.js +2 -1
- package/lib/v2/whu/news.js +48 -80
- package/lib/v2/whu/radar.js +252 -4
- package/lib/v2/whu/router.js +2 -1
- package/lib/v2/whu/templates/description.art +39 -0
- package/lib/v2/whu/util.js +148 -0
- package/lib/v2/x-mol/maintainer.js +4 -0
- package/lib/v2/x-mol/news.js +63 -0
- package/lib/v2/x-mol/paper.js +73 -0
- package/lib/v2/x-mol/radar.js +25 -0
- package/lib/v2/x-mol/router.js +4 -0
- package/lib/v2/x-mol/templates/description.art +6 -0
- package/lib/v2/x-mol/utils.js +3 -0
- package/lib/v2/xiaohongshu/user.js +33 -9
- package/lib/v2/xiaohongshu/util.js +17 -21
- package/lib/v2/yuque/utils.js +1 -0
- package/lib/v2/zhubai/radar.js +2 -1
- package/lib/v2/zhubai/templates/description.art +41 -13
- package/lib/v2/zhubai/top20.js +31 -22
- package/package.json +23 -23
- package/lib/routes/abc/documentId.js +0 -7272
- package/lib/routes/abc/id.js +0 -7272
- package/lib/routes/abc/index.js +0 -74
- package/lib/routes/blogs/paulgraham.js +0 -46
- package/lib/routes/growincity/news.js +0 -49
- package/lib/routes/grubstreet/utils.js +0 -78
- package/lib/routes/npc/index.js +0 -42
- package/lib/routes/x-mol/news.js +0 -48
- package/lib/routes/x-mol/paper.js +0 -78
- package/lib/routes/x-mol/utils.js +0 -16
- /package/lib/{routes → v2}/grubstreet/index.js +0 -0
- /package/lib/{routes → v2}/metacritic/release.js +0 -0
package/lib/router.js
CHANGED
|
@@ -992,7 +992,7 @@ router.get('/polimi/news/:language?', lazyloadRouteHandler('./routes/polimi/news
|
|
|
992
992
|
router.get('/dekudeals/:type', lazyloadRouteHandler('./routes/dekudeals'));
|
|
993
993
|
|
|
994
994
|
// Metacritic
|
|
995
|
-
router.get('/metacritic/release/:platform/:type/:sort?', lazyloadRouteHandler('./routes/metacritic/release'));
|
|
995
|
+
// router.get('/metacritic/release/:platform/:type/:sort?', lazyloadRouteHandler('./routes/metacritic/release'));
|
|
996
996
|
|
|
997
997
|
// 快科技(原驱动之家)
|
|
998
998
|
// router.get('/kkj/news', lazyloadRouteHandler('./routes/kkj/news'));
|
|
@@ -1269,8 +1269,8 @@ router.get('/wineyun/:category', lazyloadRouteHandler('./routes/wineyun'));
|
|
|
1269
1269
|
router.get('/kzfeed/topic/:id', lazyloadRouteHandler('./routes/kzfeed/topic'));
|
|
1270
1270
|
|
|
1271
1271
|
// X-MOL化学资讯平台
|
|
1272
|
-
router.get('/x-mol/news/:tag?', lazyloadRouteHandler('./routes/x-mol/news.js'));
|
|
1273
|
-
router.get('/x-mol/paper/:type/:magazine', lazyloadRouteHandler('./routes/x-mol/paper'));
|
|
1272
|
+
// router.get('/x-mol/news/:tag?', lazyloadRouteHandler('./routes/x-mol/news.js'));
|
|
1273
|
+
// router.get('/x-mol/paper/:type/:magazine', lazyloadRouteHandler('./routes/x-mol/paper'));
|
|
1274
1274
|
|
|
1275
1275
|
// 知识分子
|
|
1276
1276
|
router.get('/zhishifenzi/news/:type?', lazyloadRouteHandler('./routes/zhishifenzi/news'));
|
|
@@ -1390,7 +1390,7 @@ router.get('/vulture/:tag/:excludetags?', lazyloadRouteHandler('./routes/vulture
|
|
|
1390
1390
|
router.get('/xinwenlianbo/index', lazyloadRouteHandler('./routes/xinwenlianbo/index'));
|
|
1391
1391
|
|
|
1392
1392
|
// Paul Graham - Essays
|
|
1393
|
-
router.get('/blogs/paulgraham', lazyloadRouteHandler('./routes/blogs/paulgraham'));
|
|
1393
|
+
// router.get('/blogs/paulgraham', lazyloadRouteHandler('./routes/blogs/paulgraham'));
|
|
1394
1394
|
|
|
1395
1395
|
// invisionapp
|
|
1396
1396
|
router.get('/invisionapp/inside-design', lazyloadRouteHandler('./routes/invisionapp/inside-design'));
|
|
@@ -1732,7 +1732,7 @@ router.get('/jijitang/article/:id', lazyloadRouteHandler('./routes/jijitang/arti
|
|
|
1732
1732
|
router.get('/jijitang/publication', lazyloadRouteHandler('./routes/jijitang/publication'));
|
|
1733
1733
|
|
|
1734
1734
|
// Grub Street
|
|
1735
|
-
router.get('/grubstreet', lazyloadRouteHandler('./routes/grubstreet/index'));
|
|
1735
|
+
// router.get('/grubstreet', lazyloadRouteHandler('./routes/grubstreet/index'));
|
|
1736
1736
|
|
|
1737
1737
|
// 漫画堆
|
|
1738
1738
|
router.get('/manhuadui/manhua/:name/:serial?', lazyloadRouteHandler('./routes/manhuadui/manhua'));
|
|
@@ -2033,7 +2033,7 @@ router.get('/icity/:id', lazyloadRouteHandler('./routes/icity/index'));
|
|
|
2033
2033
|
router.get('/anki/changes', lazyloadRouteHandler('./routes/anki/changes'));
|
|
2034
2034
|
|
|
2035
2035
|
// ABC News
|
|
2036
|
-
router.get('/abc/:id?', lazyloadRouteHandler('./routes/abc'));
|
|
2036
|
+
// router.get('/abc/:id?', lazyloadRouteHandler('./routes/abc'));
|
|
2037
2037
|
|
|
2038
2038
|
// 台湾中央通讯社
|
|
2039
2039
|
// router.get('/cna/:id?', lazyloadRouteHandler('./routes/cna/index'));
|
|
@@ -2064,7 +2064,7 @@ router.get('/nobelprize/:caty?', lazyloadRouteHandler('./routes/nobelprize/index
|
|
|
2064
2064
|
router.get('/gov/taiwan/mnd', lazyloadRouteHandler('./routes/gov/taiwan/mnd'));
|
|
2065
2065
|
|
|
2066
2066
|
// 中国人大网
|
|
2067
|
-
router.get('/npc/:caty', lazyloadRouteHandler('./routes/npc/index'));
|
|
2067
|
+
// router.get('/npc/:caty', lazyloadRouteHandler('./routes/npc/index'));
|
|
2068
2068
|
|
|
2069
2069
|
// 高科技行业门户
|
|
2070
2070
|
router.get('/ofweek/news', lazyloadRouteHandler('./routes/ofweek/news'));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const randUserAgent = require('rand-user-agent');
|
|
1
|
+
const { randUserAgent } = require('@tonyrl/rand-user-agent');
|
|
2
|
+
require.resolve('@tonyrl/rand-user-agent/data/user-agents.json'); // workaround for @vercel/nft removing datastore
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A handy function to help generate a legit useragent.
|
package/lib/v2/2048/index.js
CHANGED
|
@@ -11,7 +11,11 @@ module.exports = async (ctx) => {
|
|
|
11
11
|
const rootUrl = 'https://hjd2048.com';
|
|
12
12
|
|
|
13
13
|
const entranceDomain = await ctx.cache.tryGet('2048:entranceDomain', async () => {
|
|
14
|
-
const { data: response } = await got('https://hjd.tw'
|
|
14
|
+
const { data: response } = await got('https://hjd.tw', {
|
|
15
|
+
headers: {
|
|
16
|
+
accept: '*/*',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
15
19
|
const $ = cheerio.load(response);
|
|
16
20
|
return $('ul li a')
|
|
17
21
|
.toArray()
|
|
@@ -36,14 +40,16 @@ module.exports = async (ctx) => {
|
|
|
36
40
|
.nextAll('.tr3')
|
|
37
41
|
.toArray()
|
|
38
42
|
.map((item) => {
|
|
39
|
-
item = $(item).find('.subject');
|
|
43
|
+
item = $(item).find('a.subject');
|
|
40
44
|
|
|
41
45
|
return {
|
|
42
46
|
title: item.text(),
|
|
43
47
|
link: `${currentHost}/2048/${item.attr('href')}`,
|
|
44
48
|
guid: `${rootUrl}/2048/${item.attr('href')}`,
|
|
45
49
|
};
|
|
46
|
-
})
|
|
50
|
+
})
|
|
51
|
+
.filter((item) => !item.link.includes('undefined'));
|
|
52
|
+
|
|
47
53
|
const items = await Promise.all(
|
|
48
54
|
list.map((item) =>
|
|
49
55
|
ctx.cache.tryGet(item.guid, async () => {
|
|
@@ -60,15 +66,8 @@ module.exports = async (ctx) => {
|
|
|
60
66
|
content(this).replaceWith(`<img src="${content(this).find('img').attr('src')}">`);
|
|
61
67
|
});
|
|
62
68
|
|
|
63
|
-
item.author = content('.fl.black').text();
|
|
64
|
-
item.pubDate = timezone(
|
|
65
|
-
parseDate(
|
|
66
|
-
content('.fl.gray')
|
|
67
|
-
.text()
|
|
68
|
-
.replace(/发表于: /, '')
|
|
69
|
-
),
|
|
70
|
-
+8
|
|
71
|
-
);
|
|
69
|
+
item.author = content('.fl.black').first().text();
|
|
70
|
+
item.pubDate = timezone(parseDate(content('span.fl.gray').first().attr('title')), +8);
|
|
72
71
|
|
|
73
72
|
const downloadLink = content('#read_tpc').first().find('a').last();
|
|
74
73
|
|
|
@@ -93,7 +92,13 @@ module.exports = async (ctx) => {
|
|
|
93
92
|
);
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
const desp = content('#read_tpc').first();
|
|
96
|
+
|
|
97
|
+
content('.showhide img').each(function () {
|
|
98
|
+
desp.append(`<br><img style="max-width: 100%;" src="${content(this).attr('src')}">`);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
item.description = desp.html();
|
|
97
102
|
|
|
98
103
|
return item;
|
|
99
104
|
})
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
module.exports = async (ctx) => {
|
|
8
|
+
const { category = 'news/justin' } = ctx.params;
|
|
9
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
|
|
10
|
+
|
|
11
|
+
const rootUrl = 'https://www.abc.net.au';
|
|
12
|
+
const apiUrl = new URL('news-web/api/loader/channelrefetch', rootUrl).href;
|
|
13
|
+
|
|
14
|
+
let currentUrl = '';
|
|
15
|
+
let documentId = undefined;
|
|
16
|
+
|
|
17
|
+
if (!isNaN(category)) {
|
|
18
|
+
documentId = category;
|
|
19
|
+
const feedUrl = new URL(`news/feed/${documentId}/rss.xml`, rootUrl).href;
|
|
20
|
+
|
|
21
|
+
const { data: feedResponse } = await got(feedUrl);
|
|
22
|
+
currentUrl = feedResponse.match(/<link>([\w-.:/?]+)<\/link>/)[1];
|
|
23
|
+
} else {
|
|
24
|
+
currentUrl = new URL(category, rootUrl).href;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { data: currentResponse } = await got(currentUrl);
|
|
28
|
+
|
|
29
|
+
const $ = cheerio.load(currentResponse);
|
|
30
|
+
|
|
31
|
+
documentId = documentId ?? $('div[data-uri^="coremedia://collection/"]').first().prop('data-uri').split(/\//).pop();
|
|
32
|
+
|
|
33
|
+
const { data: response } = await got(apiUrl, {
|
|
34
|
+
searchParams: {
|
|
35
|
+
name: 'PaginationArticles',
|
|
36
|
+
documentId,
|
|
37
|
+
size: limit,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
let items = response.collection.slice(0, limit).map((i) => {
|
|
42
|
+
const item = {
|
|
43
|
+
title: i.title.children ?? i.title,
|
|
44
|
+
link: new URL(i.link.to, rootUrl).href,
|
|
45
|
+
description: art(path.join(__dirname, 'templates/description.art'), {
|
|
46
|
+
image: i.image
|
|
47
|
+
? {
|
|
48
|
+
src: i.image.imgSrc.split(/\?/)[0],
|
|
49
|
+
alt: i.image.alt,
|
|
50
|
+
}
|
|
51
|
+
: undefined,
|
|
52
|
+
}),
|
|
53
|
+
author: i.newsBylineProps?.authors?.map((a) => a.name).join('/') ?? undefined,
|
|
54
|
+
guid: `abc-${i.id}`,
|
|
55
|
+
pubDate: parseDate(i.timestamp.dates.firstPublished),
|
|
56
|
+
updated: i.timestamp.dates.lastUpdated ? parseDate(i.timestamp.dates.lastUpdated) : undefined,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (i.mediaIndicator) {
|
|
60
|
+
item.enclosure_type = 'audio/mpeg';
|
|
61
|
+
item.itunes_item_image = i.image?.imgSrc.split(/\?/)[0] ?? undefined;
|
|
62
|
+
item.itunes_duration = i.mediaIndicator.duration;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return item;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
items = await Promise.all(
|
|
69
|
+
items.map((item) =>
|
|
70
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
71
|
+
try {
|
|
72
|
+
const { data: detailResponse } = await got(item.link);
|
|
73
|
+
|
|
74
|
+
const content = cheerio.load(detailResponse);
|
|
75
|
+
|
|
76
|
+
content('aside, header, [data-print="inline-media"], [data-component="EmbedBlock"]').remove();
|
|
77
|
+
|
|
78
|
+
content('#body *, div[data-component="FeatureMedia"]')
|
|
79
|
+
.children()
|
|
80
|
+
.each(function () {
|
|
81
|
+
const element = content(this);
|
|
82
|
+
if (element.prop('tagName').toLowerCase() === 'figure') {
|
|
83
|
+
element.replaceWith(
|
|
84
|
+
art(path.join(__dirname, 'templates/description.art'), {
|
|
85
|
+
image: {
|
|
86
|
+
src: element.find('img').prop('src').split(/\?/)[0],
|
|
87
|
+
alt: element.find('figcaption').text().trim(),
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
} else {
|
|
92
|
+
element.removeAttr('id class role data-component data-uri');
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
item.title = content('meta[property="og:title"]').prop('content');
|
|
97
|
+
item.description = '';
|
|
98
|
+
|
|
99
|
+
const enclosurePattern = '"(?:MIME|content)?Type":"([\\w]+/[\\w]+)".*?"(?:fileS|s)?ize":(\\d+),.*?"url":"([\\w-.:/?]+)"';
|
|
100
|
+
|
|
101
|
+
const enclosureMatches = detailResponse.match(new RegExp(enclosurePattern, 'g'));
|
|
102
|
+
|
|
103
|
+
if (enclosureMatches) {
|
|
104
|
+
const enclosureMatch = enclosureMatches
|
|
105
|
+
.map((e) => e.match(new RegExp(enclosurePattern)))
|
|
106
|
+
.sort((a, b) => parseInt(a[2], 10) - parseInt(b[2], 10))
|
|
107
|
+
.pop();
|
|
108
|
+
|
|
109
|
+
item.enclosure_url = enclosureMatch[3];
|
|
110
|
+
item.enclosure_length = enclosureMatch[2];
|
|
111
|
+
item.enclosure_type = enclosureMatch[1];
|
|
112
|
+
|
|
113
|
+
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
114
|
+
enclosure: {
|
|
115
|
+
src: item.enclosure_url,
|
|
116
|
+
type: item.enclosure_type,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
item.description =
|
|
122
|
+
art(path.join(__dirname, 'templates/description.art'), {
|
|
123
|
+
description: (content('div[data-component="FeatureMedia"]').html() || '') + (content('#body div[data-component="LayoutContainer"] div').first().html() || ''),
|
|
124
|
+
}) + item.description;
|
|
125
|
+
|
|
126
|
+
item.category = content('meta[property="article:tag"]')
|
|
127
|
+
.toArray()
|
|
128
|
+
.map((c) =>
|
|
129
|
+
content(c)
|
|
130
|
+
.prop('content')
|
|
131
|
+
.split(/,/)
|
|
132
|
+
.map((c) => c.trim())
|
|
133
|
+
)
|
|
134
|
+
.flat();
|
|
135
|
+
item.guid = `abc-${content('meta[name="ContentId"]').prop('content')}`;
|
|
136
|
+
item.pubDate = parseDate(content('meta[property="article:published_time"]').prop('content'));
|
|
137
|
+
item.updated = parseDate(content('meta[property="article:modified_time"]').prop('content'));
|
|
138
|
+
} catch (e) {
|
|
139
|
+
// eslint-disable-next-line
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return item;
|
|
143
|
+
})
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const icon = new URL($('link[rel="apple-touch-icon"]').prop('href'), rootUrl).href;
|
|
148
|
+
|
|
149
|
+
ctx.state.data = {
|
|
150
|
+
item: items,
|
|
151
|
+
title: $('title').first().text(),
|
|
152
|
+
link: currentUrl,
|
|
153
|
+
description: $('meta[property="og:description"]').prop('content'),
|
|
154
|
+
language: $('html').prop('lang'),
|
|
155
|
+
image: $('meta[property="og:image"]').prop('content').split('?')[0],
|
|
156
|
+
icon,
|
|
157
|
+
logo: icon,
|
|
158
|
+
subtitle: $('meta[property="og:title"]').prop('content'),
|
|
159
|
+
author: $('meta[name="generator"]').prop('content'),
|
|
160
|
+
allowEmpty: true,
|
|
161
|
+
};
|
|
162
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{ if image }}
|
|
2
|
+
<figure>
|
|
3
|
+
<img src="{{ image.src }}" alt="{{ image.alt }}">
|
|
4
|
+
<figcaption>{{ image.alt }}</figcaption>
|
|
5
|
+
</figure>
|
|
6
|
+
{{ /if }}
|
|
7
|
+
|
|
8
|
+
{{ if enclosure }}
|
|
9
|
+
<{{ enclosure.type.split(/\//)[0] }} controls>
|
|
10
|
+
<source
|
|
11
|
+
src="{{ enclosure.src }}"
|
|
12
|
+
type="{{ enclosure.type }}">
|
|
13
|
+
<object data="{{ enclosure.src }}">
|
|
14
|
+
<embed src="{{ enclosure.src }}">
|
|
15
|
+
</object>
|
|
16
|
+
</{{ enclosure.type.split(/\//)[0] }}>
|
|
17
|
+
{{ /if }}
|
|
18
|
+
|
|
19
|
+
{{ if description }}
|
|
20
|
+
{{@ description }}
|
|
21
|
+
{{ /if }}
|
package/lib/v2/apnews/topics.js
CHANGED
|
@@ -17,6 +17,7 @@ module.exports = async (ctx) => {
|
|
|
17
17
|
title: $(e).find('span.PagePromoContentIcons-text').text(),
|
|
18
18
|
link: $(e).find('a').attr('href'),
|
|
19
19
|
}))
|
|
20
|
+
.filter((e) => typeof e.link === 'string')
|
|
20
21
|
.map((item) =>
|
|
21
22
|
ctx.cache.tryGet(item.link, async () => {
|
|
22
23
|
const { data: response } = await got(item.link);
|
package/lib/v2/apple/apps.js
CHANGED
|
@@ -2,32 +2,103 @@ const got = require('@/utils/got');
|
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const { parseDate } = require('@/utils/parse-date');
|
|
4
4
|
|
|
5
|
+
const platformIds = {
|
|
6
|
+
osx: 'macOS',
|
|
7
|
+
ios: 'iOS',
|
|
8
|
+
appletvos: 'tvOS',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const platforms = {
|
|
12
|
+
macos: 'osx',
|
|
13
|
+
ios: 'ios',
|
|
14
|
+
tvos: 'appletvos',
|
|
15
|
+
};
|
|
16
|
+
|
|
5
17
|
module.exports = async (ctx) => {
|
|
6
|
-
const {
|
|
7
|
-
|
|
18
|
+
const { country, id } = ctx.params;
|
|
19
|
+
let { platform } = ctx.params;
|
|
20
|
+
|
|
21
|
+
let platformId;
|
|
22
|
+
|
|
23
|
+
if (platform) {
|
|
24
|
+
platform = platform.toLowerCase();
|
|
25
|
+
platformId = platforms.hasOwnProperty(platform) ? platforms[platform] : platform;
|
|
26
|
+
}
|
|
27
|
+
platform = undefined;
|
|
28
|
+
|
|
29
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 100;
|
|
30
|
+
|
|
31
|
+
const rootUrl = 'https://apps.apple.com';
|
|
32
|
+
const currentUrl = new URL(`${country}/app/${id}`, rootUrl).href;
|
|
8
33
|
|
|
9
|
-
const
|
|
10
|
-
const $ = cheerio.load(res.data);
|
|
34
|
+
const { data: response } = await got(currentUrl);
|
|
11
35
|
|
|
12
|
-
const
|
|
36
|
+
const $ = cheerio.load(response);
|
|
37
|
+
|
|
38
|
+
const subtitle = $('h2.whats-new__headline').text() || "What's New";
|
|
13
39
|
|
|
14
40
|
const appData = JSON.parse(Object.values(JSON.parse($('script#shoebox-media-api-cache-apps').text()))[0]);
|
|
15
|
-
const
|
|
16
|
-
|
|
41
|
+
const attributes = appData.d[0].attributes;
|
|
42
|
+
|
|
43
|
+
const appName = attributes.name;
|
|
44
|
+
const artistName = attributes.artistName;
|
|
45
|
+
const platformAttributes = attributes.platformAttributes;
|
|
46
|
+
|
|
47
|
+
let items = [];
|
|
48
|
+
let title = '';
|
|
49
|
+
let description = '';
|
|
50
|
+
|
|
51
|
+
if (platformId && platformAttributes.hasOwnProperty(platformId)) {
|
|
52
|
+
platform = platformIds.hasOwnProperty(platformId) ? platformIds[platformId] : platformId;
|
|
53
|
+
|
|
54
|
+
const platformAttribute = platformAttributes[platformId];
|
|
55
|
+
|
|
56
|
+
items = platformAttribute.versionHistory;
|
|
57
|
+
title = `${appName}${platform ? ` for ${platform} ` : ' '}${subtitle}`;
|
|
58
|
+
description = platformAttribute.description.standard;
|
|
59
|
+
} else {
|
|
60
|
+
title = `${appName} ${subtitle}`;
|
|
61
|
+
for (const pid of Object.keys(platformAttributes)) {
|
|
62
|
+
const platformAttribute = platformAttributes[pid];
|
|
63
|
+
items = [
|
|
64
|
+
...items,
|
|
65
|
+
...platformAttribute.versionHistory.map((v) => ({
|
|
66
|
+
...v,
|
|
67
|
+
platformId: pid,
|
|
68
|
+
})),
|
|
69
|
+
];
|
|
70
|
+
description += platformAttribute.description.standard;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
items = items.slice(0, limit).map((item) => {
|
|
75
|
+
const pid = item.platformId ?? platformId;
|
|
76
|
+
const p = platform ? platform : platformIds.hasOwnProperty(pid) ? platformIds[pid] : pid;
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
title: `${appName} ${item.versionDisplay} for ${p}`,
|
|
80
|
+
link: currentUrl,
|
|
81
|
+
description: item.releaseNotes?.replace(/\n/g, '<br>'),
|
|
82
|
+
category: [p],
|
|
83
|
+
guid: `apple/apps/${country}/${id}/${pid}#${item.versionDisplay}`,
|
|
84
|
+
pubDate: parseDate(item.releaseTimestamp),
|
|
85
|
+
};
|
|
86
|
+
});
|
|
17
87
|
|
|
18
|
-
const
|
|
19
|
-
title: `${appName} ${item.versionDisplay}`,
|
|
20
|
-
description: item.releaseNotes?.replace(/\n/g, '<br>'),
|
|
21
|
-
pubDate: parseDate(item.releaseTimestamp),
|
|
22
|
-
guid: `apple:apps:update:${country}:${id}:${item.versionDisplay}`,
|
|
23
|
-
link: url,
|
|
24
|
-
}));
|
|
88
|
+
const icon = new URL('favicon.ico', rootUrl).href;
|
|
25
89
|
|
|
26
90
|
ctx.state.data = {
|
|
27
|
-
title: `${appName} for ${webPlatform === 'App Store' ? 'iOS' : 'macOS'} ${country === 'cn' ? '更新' : 'Update'}`,
|
|
28
|
-
description: platform.description.standard?.replace(/\n/g, ' '),
|
|
29
|
-
link: url,
|
|
30
91
|
item: items,
|
|
92
|
+
title,
|
|
93
|
+
link: currentUrl,
|
|
94
|
+
description: description?.replace(/\n/g, ' '),
|
|
95
|
+
language: $('html').prop('lang'),
|
|
96
|
+
image: $('meta[property="og:image"]').prop('content'),
|
|
97
|
+
icon,
|
|
98
|
+
logo: icon,
|
|
99
|
+
subtitle: appName,
|
|
100
|
+
author: artistName,
|
|
101
|
+
allowEmpty: true,
|
|
31
102
|
};
|
|
32
103
|
|
|
33
104
|
ctx.state.json = {
|
package/lib/v2/apple/radar.js
CHANGED
|
@@ -4,9 +4,9 @@ module.exports = {
|
|
|
4
4
|
apps: [
|
|
5
5
|
{
|
|
6
6
|
title: 'App Update',
|
|
7
|
-
docs: 'https://docs.rsshub.app/routes/program-update#app-store-mac-app-store',
|
|
8
|
-
source: ['/:
|
|
9
|
-
target: '/
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/program-update#app-store-mac-app-store-app-update',
|
|
8
|
+
source: ['/:country/app/:appSlug/:id', '/:country/app/:id'],
|
|
9
|
+
target: '/apple/apps/update/:country/:id',
|
|
10
10
|
},
|
|
11
11
|
],
|
|
12
12
|
support: [
|
package/lib/v2/apple/router.js
CHANGED
|
@@ -5,63 +5,109 @@ const { art } = require('@/utils/render');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
7
|
module.exports = async (ctx) => {
|
|
8
|
-
const category = ctx.params
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const urls = {
|
|
12
|
-
'': '',
|
|
13
|
-
category: `/category-${keyword}`,
|
|
14
|
-
tag: `/tag-${keyword}`,
|
|
15
|
-
search: `/search/${keyword}`,
|
|
16
|
-
};
|
|
8
|
+
const { category } = ctx.params;
|
|
9
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 24;
|
|
17
10
|
|
|
18
11
|
const rootUrl = 'https://asiantolick.com';
|
|
19
|
-
const
|
|
12
|
+
const apiUrl = new URL('ajax/buscar_posts.php', rootUrl).href;
|
|
13
|
+
const currentUrl = new URL(category?.replace(/^(tag|category)?\/(\d+)/, '$1-$2') ?? '', rootUrl).href;
|
|
14
|
+
|
|
15
|
+
const searchParams = {};
|
|
16
|
+
const matches = category?.match(/^(tag|category|search|page)?(?:-|\/)?(\w+)/) ?? undefined;
|
|
17
|
+
|
|
18
|
+
if (matches) {
|
|
19
|
+
const key = matches[1] === 'category' ? 'cat' : matches[1];
|
|
20
|
+
const value = matches[2];
|
|
21
|
+
searchParams[key] = value;
|
|
22
|
+
} else if (category) {
|
|
23
|
+
searchParams.page = 'news';
|
|
24
|
+
}
|
|
20
25
|
|
|
21
|
-
const response = await got({
|
|
22
|
-
|
|
23
|
-
url: currentUrl,
|
|
26
|
+
const { data: response } = await got(apiUrl, {
|
|
27
|
+
searchParams,
|
|
24
28
|
});
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
let $ = cheerio.load(response);
|
|
27
31
|
|
|
28
|
-
let items = $('.miniatura')
|
|
32
|
+
let items = $('a.miniatura')
|
|
33
|
+
.slice(0, limit)
|
|
29
34
|
.toArray()
|
|
30
35
|
.map((item) => {
|
|
31
36
|
item = $(item);
|
|
32
37
|
|
|
38
|
+
const image = item.find('div.background_miniatura img');
|
|
39
|
+
|
|
33
40
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
title: item.find('div.base_tt').text(),
|
|
42
|
+
link: item.prop('href'),
|
|
43
|
+
description: art(path.join(__dirname, 'templates/description.art'), {
|
|
44
|
+
images: image
|
|
45
|
+
? [
|
|
46
|
+
{
|
|
47
|
+
src: image.prop('data-src').split(/\?/)[0],
|
|
48
|
+
alt: image.prop('alt'),
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: undefined,
|
|
52
|
+
}),
|
|
53
|
+
author: item.find('.author').text(),
|
|
54
|
+
category: item
|
|
55
|
+
.find('.category')
|
|
56
|
+
.toArray()
|
|
57
|
+
.map((c) => $(c).text()),
|
|
58
|
+
guid: image ? image.prop('post-id') : item.link.match(/\/(\d+)/)[1],
|
|
36
59
|
};
|
|
37
60
|
});
|
|
38
61
|
|
|
39
62
|
items = await Promise.all(
|
|
40
63
|
items.map((item) =>
|
|
41
64
|
ctx.cache.tryGet(item.link, async () => {
|
|
42
|
-
const detailResponse = await got(
|
|
43
|
-
method: 'get',
|
|
44
|
-
url: item.link,
|
|
45
|
-
});
|
|
65
|
+
const { data: detailResponse } = await got(item.link);
|
|
46
66
|
|
|
47
|
-
const content = cheerio.load(detailResponse
|
|
67
|
+
const content = cheerio.load(detailResponse);
|
|
48
68
|
|
|
69
|
+
item.title = content('h1').first().text();
|
|
49
70
|
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
50
|
-
|
|
71
|
+
description: content('#metadata_qrcode').html(),
|
|
72
|
+
images: content('div.miniatura')
|
|
51
73
|
.toArray()
|
|
52
|
-
.map((i) =>
|
|
74
|
+
.map((i) => ({
|
|
75
|
+
src: content(i).prop('data-src'),
|
|
76
|
+
alt: content(i).find('img').prop('alt'),
|
|
77
|
+
})),
|
|
53
78
|
});
|
|
79
|
+
item.author = content('.author').text();
|
|
80
|
+
item.category = content('#categoria_tags_post a')
|
|
81
|
+
.toArray()
|
|
82
|
+
.map((c) => content(c).text().trim().replace(/^#/, ''));
|
|
83
|
+
item.pubDate = parseDate(detailResponse.match(/"pubDate":\s"((?!http)[^"]*)"/)[1]);
|
|
84
|
+
item.updated = parseDate(detailResponse.match(/"upDate":\s"((?!http)[^"]*)"/)[1]);
|
|
85
|
+
item.enclosure_url = new URL(`ajax/download_post.php?ver=3&dir=/down/new_${item.guid}&post_id=${item.guid}&post_name=${detailResponse.match(/"title":\s"((?!http)[^"]*)"/)[1]}`, rootUrl).href;
|
|
54
86
|
|
|
55
|
-
item.
|
|
87
|
+
item.guid = `asiantolick-${item.guid}`;
|
|
56
88
|
|
|
57
89
|
return item;
|
|
58
90
|
})
|
|
59
91
|
)
|
|
60
92
|
);
|
|
61
93
|
|
|
94
|
+
const { data: currentResponse } = await got(currentUrl);
|
|
95
|
+
|
|
96
|
+
$ = cheerio.load(currentResponse);
|
|
97
|
+
|
|
98
|
+
const title = $('title').text().split(/-/)[0].trim();
|
|
99
|
+
const icon = $('link[rel="icon"]').first().prop('href');
|
|
100
|
+
|
|
62
101
|
ctx.state.data = {
|
|
63
|
-
title: $('title').text(),
|
|
64
|
-
link: currentUrl,
|
|
65
102
|
item: items,
|
|
103
|
+
title: title === 'Asian To Lick' ? title : `Asian To Lick - ${title}`,
|
|
104
|
+
link: currentUrl,
|
|
105
|
+
description: $('meta[property="og:description"]').prop('content'),
|
|
106
|
+
language: $('html').prop('lang'),
|
|
107
|
+
image: $('meta[name="msapplication-TileImage"]').prop('content'),
|
|
108
|
+
icon,
|
|
109
|
+
logo: icon,
|
|
110
|
+
subtitle: title,
|
|
111
|
+
allowEmpty: true,
|
|
66
112
|
};
|
|
67
113
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
'/': ['nczitzk'],
|
|
3
|
-
'/category/:id
|
|
4
|
-
'/
|
|
5
|
-
'/
|
|
3
|
+
'/category/:id': ['nczitzk'],
|
|
4
|
+
'/page/news': ['nczitzk'],
|
|
5
|
+
'/page/:id': ['nczitzk'],
|
|
6
|
+
'/search/:keyword': ['nczitzk'],
|
|
7
|
+
'/tag/:id': ['nczitzk'],
|
|
6
8
|
};
|