rsshub 1.0.0-master.f9ec483 → 1.0.0-master.fa1dcc5
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.ts +42 -1
- package/lib/middleware/access-control.ts +3 -3
- package/lib/middleware/cache.ts +5 -3
- package/lib/middleware/template.test.ts +6 -0
- package/lib/middleware/template.tsx +3 -1
- package/lib/router.js +0 -6
- package/lib/routes/141jav/index.ts +1 -1
- package/lib/routes/141ppv/index.ts +1 -1
- package/lib/routes/36kr/hot-list.ts +1 -1
- package/lib/routes/36kr/index.ts +1 -1
- package/lib/routes/78dm/index.ts +429 -43
- package/lib/routes/78dm/namespace.ts +2 -0
- package/lib/routes/78dm/templates/description.art +17 -0
- package/lib/routes/abc/index.ts +10 -9
- package/lib/routes/aeon/category.ts +1 -1
- package/lib/routes/aeon/type.ts +1 -1
- package/lib/routes/afr/latest.ts +69 -0
- package/lib/routes/afr/namespace.ts +7 -0
- package/lib/routes/afr/navigation.ts +75 -0
- package/lib/routes/afr/query.ts +349 -0
- package/lib/routes/afr/utils.ts +80 -0
- package/lib/routes/aibase/discover.ts +1 -1
- package/lib/routes/aibase/news.ts +1 -1
- package/lib/routes/aibase/topic.ts +1 -1
- package/lib/routes/air-level/index.ts +49 -0
- package/lib/routes/air-level/levelrank.ts +65 -0
- package/lib/routes/air-level/namespace.ts +12 -0
- package/lib/routes/ajcass/namespace.ts +11 -0
- package/lib/routes/ajcass/shxyj.ts +73 -0
- package/lib/routes/alpinelinux/pkgs.ts +2 -2
- package/lib/routes/anime1/anime.ts +1 -1
- package/lib/routes/apnews/utils.ts +6 -2
- package/lib/routes/appleinsider/index.ts +1 -1
- package/lib/routes/aqara/region.ts +1 -1
- package/lib/routes/asus/bios.ts +0 -1
- package/lib/routes/baoyu/index.ts +57 -0
- package/lib/routes/baoyu/namespace.ts +8 -0
- package/lib/routes/bilibili/article.ts +37 -14
- package/lib/routes/bilibili/dynamic.ts +15 -7
- package/lib/routes/bilibili/followings-dynamic.ts +2 -2
- package/lib/routes/bilibili/manga-update.ts +3 -0
- package/lib/routes/bilibili/ranking.ts +188 -117
- package/lib/routes/bilibili/reply.ts +2 -0
- package/lib/routes/bilibili/templates/description.art +2 -0
- package/lib/routes/bing/daily-wallpaper.ts +5 -1
- package/lib/routes/bsky/posts.ts +0 -1
- package/lib/routes/bsky/templates/post.art +8 -1
- package/lib/routes/buaa/lib/space/newbook.ts +1 -1
- package/lib/routes/c114/namespace.ts +2 -0
- package/lib/routes/c114/roll.ts +71 -42
- package/lib/routes/cags/edu/index.ts +84 -0
- package/lib/routes/cags/namespace.ts +9 -0
- package/lib/routes/caixin/article.ts +1 -1
- package/lib/routes/caixin/blog.ts +2 -3
- package/lib/routes/caixin/category.ts +1 -1
- package/lib/routes/caixin/latest.ts +12 -16
- package/lib/routes/caixin/namespace.ts +1 -1
- package/lib/routes/caixin/utils-fulltext.ts +51 -0
- package/lib/routes/caixin/utils.ts +37 -37
- package/lib/routes/cara/likes.ts +1 -1
- package/lib/routes/cara/portfolio.ts +1 -1
- package/lib/routes/cara/timeline.ts +1 -1
- package/lib/routes/ccfa/index.ts +11 -11
- package/lib/routes/chub/characters.ts +1 -1
- package/lib/routes/cnbeta/namespace.ts +1 -1
- package/lib/routes/cngold/index.ts +195 -0
- package/lib/routes/cngold/namespace.ts +9 -0
- package/lib/routes/cnki/author.ts +120 -48
- package/lib/routes/cnki/utils.ts +4 -4
- package/lib/routes/coomer/artist.ts +1 -1
- package/lib/routes/coomer/namespace.ts +1 -1
- package/lib/routes/coomer/posts.ts +2 -2
- package/lib/routes/coomer/utils.ts +1 -1
- package/lib/routes/cpcaauto/index.ts +22 -22
- package/lib/routes/cs/zzkx.ts +1 -1
- package/lib/routes/csdn/blog.ts +17 -13
- package/lib/routes/cybersecurityventures/namespace.ts +7 -0
- package/lib/routes/cybersecurityventures/news.ts +121 -0
- package/lib/routes/cybersecurityventures/types.ts +17 -0
- package/lib/routes/daily/discussed.ts +22 -21
- package/lib/routes/daily/index.ts +14 -11
- package/lib/routes/daily/namespace.ts +1 -1
- package/lib/routes/daily/source.ts +186 -0
- package/lib/routes/daily/upvoted.ts +17 -17
- package/lib/routes/daily/user.ts +6 -23
- package/lib/routes/daily/utils.ts +27 -32
- package/lib/routes/dataguidance/index.ts +19 -30
- package/lib/routes/dcfever/news.ts +1 -1
- package/lib/routes/dcfever/reviews.ts +1 -1
- package/lib/routes/dcfever/trading-search.ts +1 -1
- package/lib/routes/dcfever/trading.ts +1 -1
- package/lib/routes/deeplearning/namespace.ts +3 -1
- package/lib/routes/deeplearning/templates/description.art +21 -0
- package/lib/routes/deeplearning/the-batch.ts +296 -0
- package/lib/routes/deepmind/blog.ts +1 -1
- package/lib/routes/digitalcameraworld/news.ts +1 -1
- package/lib/routes/discord/discord-api.ts +44 -2
- package/lib/routes/discord/search.ts +106 -0
- package/lib/routes/dn/news.ts +1 -1
- package/lib/routes/dockerhub/repositories.ts +42 -0
- package/lib/routes/dongqiudi/daily.ts +1 -1
- package/lib/routes/dw/namespace.ts +6 -0
- package/lib/routes/dw/news.ts +89 -0
- package/lib/routes/dw/rss.ts +62 -0
- package/lib/routes/dw/templates/description.art +23 -0
- package/lib/routes/dw/templates/liveblog.art +13 -0
- package/lib/routes/dw/templates/video.art +14 -0
- package/lib/routes/dw/utils.ts +172 -0
- package/lib/routes/ecnu/jwc.ts +5 -1
- package/lib/routes/espn/news.ts +1 -1
- package/lib/routes/fashionnetwork/namespace.ts +1 -1
- package/lib/routes/flyert/forum.ts +99 -0
- package/lib/routes/flyert/namespace.ts +1 -0
- package/lib/routes/flyert/templates/description.art +21 -0
- package/lib/routes/flyert/util.ts +188 -0
- package/lib/routes/follow/profile.ts +2 -2
- package/lib/routes/foresightnews/article.ts +1 -1
- package/lib/routes/foresightnews/column.ts +1 -1
- package/lib/routes/foresightnews/index.ts +3 -1
- package/lib/routes/foresightnews/news.ts +1 -1
- package/lib/routes/freecomputerbooks/index.ts +0 -10
- package/lib/routes/ftm/index.ts +1 -1
- package/lib/routes/furaffinity/art.ts +85 -0
- package/lib/routes/furaffinity/browse.ts +58 -0
- package/lib/routes/furaffinity/commissions.ts +55 -0
- package/lib/routes/furaffinity/home.ts +80 -0
- package/lib/routes/furaffinity/journal-comments.ts +64 -0
- package/lib/routes/furaffinity/journals.ts +56 -0
- package/lib/routes/furaffinity/namespace.ts +7 -0
- package/lib/routes/furaffinity/search.ts +72 -0
- package/lib/routes/furaffinity/shouts.ts +56 -0
- package/lib/routes/furaffinity/status.ts +58 -0
- package/lib/routes/furaffinity/submission-comments.ts +64 -0
- package/lib/{routes-deprecated/furaffinity/user.js → routes/furaffinity/user.ts} +53 -41
- package/lib/routes/furaffinity/watchers.ts +62 -0
- package/lib/routes/furaffinity/watching.ts +62 -0
- package/lib/routes/google/developers.ts +71 -0
- package/lib/routes/google/news.ts +26 -6
- package/lib/routes/gov/cbirc/index.ts +35 -35
- package/lib/routes/hamel/index.ts +81 -0
- package/lib/routes/hamel/namespace.ts +7 -0
- package/lib/routes/hellogithub/volume.ts +3 -0
- package/lib/routes/hket/index.ts +13 -1
- package/lib/routes/hostmonit/cloudflareyesv6.ts +1 -1
- package/lib/routes/hrbeu/sec/list.ts +80 -0
- package/lib/routes/hrbust/jwzx.ts +6 -0
- package/lib/routes/hunau/gfxy/index.ts +1 -1
- package/lib/routes/hunau/ied.ts +1 -1
- package/lib/routes/hunau/jwc.ts +1 -1
- package/lib/routes/hunau/xky/index.ts +1 -1
- package/lib/routes/hust/gs.ts +4 -3
- package/lib/routes/idolmaster/namespace.ts +7 -0
- package/lib/routes/idolmaster/news.ts +112 -0
- package/lib/routes/ieee/author.ts +95 -0
- package/lib/routes/ikea/cn/low-price.ts +2 -1
- package/lib/routes/imdb/chart.ts +1 -1
- package/lib/routes/inspirehep/author.ts +9 -1
- package/lib/routes/isct/namespace.ts +11 -0
- package/lib/routes/isct/news.ts +66 -0
- package/lib/routes/javtrailers/casts.ts +41 -0
- package/lib/routes/javtrailers/categories.ts +40 -0
- package/lib/routes/javtrailers/namespace.ts +7 -0
- package/lib/routes/javtrailers/studios.ts +39 -0
- package/lib/routes/javtrailers/templates/description.art +31 -0
- package/lib/routes/javtrailers/types.ts +59 -0
- package/lib/routes/javtrailers/utils.ts +48 -0
- package/lib/routes/jiemian/list.ts +1 -1
- package/lib/routes/jiuyangongshe/community.ts +1 -1
- package/lib/routes/jlu/phy/index.ts +55 -0
- package/lib/routes/joins/chinese.ts +13 -13
- package/lib/routes/kcna/news.ts +7 -5
- package/lib/routes/keep/user.ts +1 -1
- package/lib/routes/langchain/index.ts +74 -0
- package/lib/routes/langchain/namespace.ts +7 -0
- package/lib/routes/last-origin/namespace.ts +7 -0
- package/lib/routes/last-origin/news.ts +65 -0
- package/lib/routes/linkresearcher/index.ts +108 -46
- package/lib/routes/linkresearcher/namespace.ts +8 -2
- package/lib/routes/linkresearcher/templates/bilingual.art +7 -0
- package/lib/routes/linkresearcher/types.ts +103 -0
- package/lib/routes/liulinblog/itnews.ts +1 -1
- package/lib/routes/lofter/collection.ts +1 -1
- package/lib/routes/lofter/tag.ts +1 -1
- package/lib/routes/logrocket/index.ts +71 -0
- package/lib/routes/logrocket/namespace.ts +7 -0
- package/lib/routes/m-78/namespace.ts +7 -0
- package/lib/routes/m-78/news.ts +115 -0
- package/lib/routes/m-78/types.ts +13 -0
- package/lib/routes/mastodon/account-id.ts +1 -1
- package/lib/routes/mastodon/acct.ts +1 -1
- package/lib/routes/mastodon/timeline-local.ts +2 -2
- package/lib/routes/mastodon/timeline-remote.ts +2 -2
- package/lib/routes/mastodon/utils.ts +1 -1
- package/lib/routes/metacritic/index.ts +1 -1
- package/lib/routes/mi/utils.ts +1 -1
- package/lib/routes/mihoyo/bbs/official.ts +2 -1
- package/lib/routes/misskey/utils.ts +19 -1
- package/lib/routes/mittrchina/index.ts +2 -2
- package/lib/routes/natgeo/natgeo.ts +25 -24
- package/lib/routes/nbd/daily.ts +1 -1
- package/lib/routes/nielsberglund/index.ts +78 -0
- package/lib/routes/nielsberglund/namespace.ts +7 -0
- package/lib/routes/nytimes/rss.ts +57 -0
- package/lib/routes/openrice/chart.ts +68 -0
- package/lib/routes/openrice/templates/chart.art +9 -0
- package/lib/routes/openrice/voting.ts +84 -0
- package/lib/routes/oschina/news.ts +26 -7
- package/lib/routes/patreon/feed.ts +126 -0
- package/lib/routes/patreon/namespace.ts +7 -0
- package/lib/routes/patreon/templates/description.art +39 -0
- package/lib/routes/patreon/types.ts +387 -0
- package/lib/routes/pixiv/api/get-illust-detail.ts +22 -0
- package/lib/routes/pixiv/novel-api/content/nsfw.ts +73 -0
- package/lib/routes/pixiv/novel-api/content/sfw.ts +63 -0
- package/lib/routes/pixiv/novel-api/content/types.ts +254 -0
- package/lib/routes/pixiv/novel-api/content/utils.ts +133 -0
- package/lib/routes/pixiv/novel-api/series/nsfw.ts +84 -0
- package/lib/routes/pixiv/novel-api/series/sfw.ts +70 -0
- package/lib/routes/pixiv/novel-api/series/types.ts +94 -0
- package/lib/routes/pixiv/novel-api/user-novels/nsfw.ts +82 -0
- package/lib/routes/pixiv/novel-api/user-novels/sfw.ts +74 -0
- package/lib/routes/pixiv/novel-api/user-novels/types.ts +133 -0
- package/lib/routes/pixiv/novel-series.ts +52 -0
- package/lib/routes/pixiv/novels.ts +69 -44
- package/lib/routes/pixiv/utils.ts +3 -0
- package/lib/routes/plurk/anonymous.ts +1 -1
- package/lib/routes/plurk/hotlinks.ts +1 -1
- package/lib/routes/plurk/news.ts +1 -1
- package/lib/routes/plurk/search.ts +1 -1
- package/lib/routes/qstheory/index.ts +121 -0
- package/lib/routes/qstheory/magazine.ts +64 -0
- package/lib/routes/qstheory/namespace.ts +7 -0
- package/lib/routes/qstheory/utils.ts +25 -0
- package/lib/routes/ruc/ai.ts +1 -1
- package/lib/routes/scmp/coronavirus.ts +1 -1
- package/lib/routes/scu/jwc/tzgg.ts +75 -0
- package/lib/routes/scu/namespace.ts +7 -0
- package/lib/routes/scu/scupi/_utils.ts +62 -0
- package/lib/routes/scu/scupi/notice.ts +41 -0
- package/lib/routes/solidot/namespace.ts +1 -1
- package/lib/routes/stbu/jsjxy.ts +4 -1
- package/lib/routes/steam/search.ts +7 -0
- package/lib/routes/sycl/feeds.ts +1 -1
- package/lib/routes/syosetu/dev.ts +67 -0
- package/lib/routes/syosetu/index.ts +85 -0
- package/lib/routes/syosetu/namespace.ts +2 -2
- package/lib/routes/syosetu/ranking-isekai.ts +93 -0
- package/lib/routes/syosetu/ranking-r18.ts +192 -0
- package/lib/routes/syosetu/ranking.ts +285 -0
- package/lib/routes/syosetu/search.ts +161 -0
- package/lib/routes/syosetu/templates/description.art +73 -0
- package/lib/routes/syosetu/types/ranking-r18.ts +60 -0
- package/lib/routes/syosetu/types/ranking.ts +67 -0
- package/lib/routes/syosetu/types/search.ts +138 -0
- package/lib/routes/syosetu/utils.ts +50 -0
- package/lib/routes/telegram/channel.ts +31 -1
- package/lib/routes/telegram/scripts/get-telegram-session.mjs +16 -6
- package/lib/routes/telegram/stickerpack.ts +1 -1
- package/lib/routes/telegram/tglib/channel.ts +12 -9
- package/lib/routes/telegram/tglib/client.ts +13 -9
- package/lib/routes/test/index.ts +4 -0
- package/lib/routes/theblockbeats/index.ts +1 -1
- package/lib/routes/thegradient/index.ts +80 -0
- package/lib/routes/thegradient/namespace.ts +7 -0
- package/lib/routes/theinitium/app.ts +4 -0
- package/lib/routes/thepaper/channel.ts +1 -1
- package/lib/routes/thepaper/factpaper.ts +1 -1
- package/lib/routes/thepaper/featured.ts +1 -1
- package/lib/routes/thepaper/list.ts +1 -1
- package/lib/routes/thepaper/user.ts +174 -0
- package/lib/routes/tongji/sem/_utils.ts +65 -0
- package/lib/routes/tongji/sem/notice.ts +58 -0
- package/lib/routes/toutiao/a-bogus.ts +540 -0
- package/lib/routes/toutiao/namespace.ts +7 -0
- package/lib/routes/toutiao/templates/video.art +7 -0
- package/lib/routes/toutiao/types.ts +443 -0
- package/lib/routes/toutiao/user.ts +127 -0
- package/lib/routes/twitter/api/mobile-api/api.ts +8 -0
- package/lib/routes/twitter/api/web-api/utils.ts +21 -9
- package/lib/routes/twitter/namespace.ts +1 -0
- package/lib/routes/twitter/utils.ts +7 -1
- package/lib/routes/vertikal/latest.ts +73 -0
- package/lib/routes/vertikal/namespace.ts +7 -0
- package/lib/routes/vice/topic.ts +1 -1
- package/lib/routes/vocus/publication.ts +1 -1
- package/lib/routes/vocus/user.ts +1 -1
- package/lib/routes/wallstreetcn/calendar.ts +90 -0
- package/lib/routes/wallstreetcn/hot.ts +2 -2
- package/lib/routes/wallstreetcn/live.ts +1 -1
- package/lib/routes/wallstreetcn/news.ts +5 -3
- package/lib/routes/weibo/timeline.ts +3 -2
- package/lib/routes/wellcee/rent.ts +1 -1
- package/lib/routes/wufazhuce/namespace.ts +7 -0
- package/lib/routes/wufazhuce/one.ts +90 -0
- package/lib/routes/xiaoheihe/discount.ts +72 -28
- package/lib/routes/xiaohongshu/user.ts +40 -3
- package/lib/routes/xiaohongshu/util.ts +112 -105
- package/lib/routes/xsijishe/rank.ts +33 -7
- package/lib/routes/xueqiu/cookies.ts +13 -18
- package/lib/routes/yahoo/news/listid.ts +4 -1
- package/lib/routes/yahoo/news/provider-helper.ts +4 -1
- package/lib/routes/yahoo/news/provider.ts +4 -1
- package/lib/routes/yande/post.ts +13 -3
- package/lib/routes/youtube/user.ts +37 -25
- package/lib/routes/zhonglun/index.ts +5 -6
- package/lib/routes/zjut/cs/index.ts +1 -1
- package/lib/utils/got.ts +2 -1
- package/lib/utils/helpers.test.ts +13 -1
- package/lib/utils/helpers.ts +10 -0
- package/lib/utils/ofetch.ts +3 -0
- package/lib/utils/request-rewriter/fetch.test.ts +94 -0
- package/lib/utils/request-rewriter/fetch.ts +14 -1
- package/lib/views/error.tsx +1 -1
- package/package.json +40 -37
- package/lib/routes/78dm/templates/image.art +0 -1
- package/lib/routes/deeplearning/thebatch.ts +0 -74
- package/lib/routes/syosetu/chapter.ts +0 -87
- package/lib/routes/xiaohongshu/notes.ts +0 -39
- package/lib/routes-deprecated/furaffinity/browse.js +0 -44
- package/lib/routes-deprecated/furaffinity/commissions.js +0 -39
- package/lib/routes-deprecated/furaffinity/favorites.js +0 -56
- package/lib/routes-deprecated/furaffinity/gallery.js +0 -56
- package/lib/routes-deprecated/furaffinity/home.js +0 -72
- package/lib/routes-deprecated/furaffinity/journal-comments.js +0 -50
- package/lib/routes-deprecated/furaffinity/journals.js +0 -49
- package/lib/routes-deprecated/furaffinity/scraps.js +0 -56
- package/lib/routes-deprecated/furaffinity/search.js +0 -56
- package/lib/routes-deprecated/furaffinity/shouts.js +0 -40
- package/lib/routes-deprecated/furaffinity/status.js +0 -38
- package/lib/routes-deprecated/furaffinity/submission-comments.js +0 -50
- package/lib/routes-deprecated/furaffinity/watchers.js +0 -47
- package/lib/routes-deprecated/furaffinity/watching.js +0 -47
- package/lib/routes-deprecated/ieee/author.js +0 -30
- package/lib/routes-deprecated/qstheory/index.js +0 -122
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import { config } from '@/config';
|
|
3
|
+
import Parser from 'rss-parser';
|
|
4
|
+
import { processItems } from './utils';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/rss/:channel?',
|
|
8
|
+
categories: ['traditional-media'],
|
|
9
|
+
example: '/dw/rss/rss-en-all',
|
|
10
|
+
parameters: {
|
|
11
|
+
category: 'RSS Feed Channel, see below, `rss-en-all` by default',
|
|
12
|
+
},
|
|
13
|
+
features: {
|
|
14
|
+
requirePuppeteer: false,
|
|
15
|
+
antiCrawler: false,
|
|
16
|
+
supportBT: false,
|
|
17
|
+
supportPodcast: false,
|
|
18
|
+
supportScihub: false,
|
|
19
|
+
requireConfig: false,
|
|
20
|
+
},
|
|
21
|
+
name: 'RSS',
|
|
22
|
+
maintainers: ['quiniapiezoelectricity'],
|
|
23
|
+
handler,
|
|
24
|
+
description: `
|
|
25
|
+
For a full list of RSS Feed Channels in English, please refer to [DW RSS Feeds](https://corporate.dw.com/en/rss-feeds/a-68693346).
|
|
26
|
+
RSS Feed Channels in other languages are also available, for example: \`rss-chi-all\` renders the RSS feed in Chinese and \`rss-de-all\` for the RSS Feed in German
|
|
27
|
+
`,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
async function handler(ctx) {
|
|
31
|
+
const category = ctx.req.param('channel') ?? 'rss-en-all';
|
|
32
|
+
|
|
33
|
+
const parser = new Parser({
|
|
34
|
+
customFields: {
|
|
35
|
+
item: ['dwsyn:contentID'],
|
|
36
|
+
},
|
|
37
|
+
headers: {
|
|
38
|
+
'User-Agent': config.ua,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const feed = await parser.parseURL(`https://rss.dw.com/rdf/${category}`);
|
|
43
|
+
const items = await processItems(
|
|
44
|
+
feed.items.map((item) => {
|
|
45
|
+
item.id = item['dwsyn:contentID'];
|
|
46
|
+
item.pubDate = item.isoDate;
|
|
47
|
+
item.description = item.content;
|
|
48
|
+
const link = new URL(item.link);
|
|
49
|
+
link.search = '';
|
|
50
|
+
item.link = link.href;
|
|
51
|
+
item.type = link.pathname.substring(link.pathname.lastIndexOf('/') + 1).startsWith('live-') ? 'liveblog' : 'article'; // dw rss feed only includes liveblogs and articles
|
|
52
|
+
return item;
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
title: feed.title,
|
|
58
|
+
link: feed.link,
|
|
59
|
+
description: feed.description,
|
|
60
|
+
item: items,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{ if teaser }}
|
|
2
|
+
<blockquote><p><em>{{ teaser }}</em></p></blockquote>
|
|
3
|
+
{{ /if }}
|
|
4
|
+
{{ if video }}
|
|
5
|
+
{{@ video }}
|
|
6
|
+
{{ else if mainImage }}
|
|
7
|
+
<figure>
|
|
8
|
+
<img
|
|
9
|
+
src="https://static.dw.com/image/{{ mainImage.targetId }}_{{ formatId }}.jpg"
|
|
10
|
+
alt="{{ mainImage.additionalInformation }}"
|
|
11
|
+
>
|
|
12
|
+
<figcaption>
|
|
13
|
+
{{ mainImage.description }}
|
|
14
|
+
<small>{{ imageI18n }}: {{ mainImage.target.licenserSupplement }}</small>
|
|
15
|
+
</figcaption>
|
|
16
|
+
</figure>
|
|
17
|
+
{{ /if }}
|
|
18
|
+
{{ if text }}
|
|
19
|
+
{{@ text }}
|
|
20
|
+
{{ /if }}
|
|
21
|
+
{{ if liveblog }}
|
|
22
|
+
{{@ liveblog }}
|
|
23
|
+
{{ /if }}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{ if posts }}
|
|
2
|
+
{{ each posts }}
|
|
3
|
+
<hr>
|
|
4
|
+
{{ if $value.localizedContentDate }}<p><i>{{ $value.localizedContentDate }}</i></p>{{ /if }}
|
|
5
|
+
{{ if $value.title }}<h2>{{ $value.title }}</h2>{{ /if }}
|
|
6
|
+
{{ if $value.persons }}
|
|
7
|
+
{{ each $value.persons }}
|
|
8
|
+
<p><i>{{ $value.fullName }}</i></p>
|
|
9
|
+
{{ /each }}
|
|
10
|
+
{{ /if }}
|
|
11
|
+
{{ if $value.text }}{{@ $value.text }}{{ /if }}
|
|
12
|
+
{{ /each }}
|
|
13
|
+
{{ /if }}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{ if hlsVideoSrc }}
|
|
2
|
+
<video
|
|
3
|
+
{{ if posterImageUrl }} poster="{{ posterImageUrl }}" {{ /if }}
|
|
4
|
+
controls preload="metadata">
|
|
5
|
+
<source
|
|
6
|
+
src="{{ hlsVideoSrc }}"
|
|
7
|
+
type="application/x-mpegURL"
|
|
8
|
+
>
|
|
9
|
+
<source
|
|
10
|
+
src="{{ mp4VideoSrc }}"
|
|
11
|
+
type="video/mp4"
|
|
12
|
+
>
|
|
13
|
+
</video>
|
|
14
|
+
{{ /if }}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import cache from '@/utils/cache';
|
|
2
|
+
import got from '@/utils/got';
|
|
3
|
+
import { load, type CheerioAPI } from 'cheerio';
|
|
4
|
+
import { art } from '@/utils/render';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { getCurrentPath } from '@/utils/helpers';
|
|
7
|
+
|
|
8
|
+
const __dirname = getCurrentPath(import.meta.url);
|
|
9
|
+
const formatId = '605';
|
|
10
|
+
|
|
11
|
+
const i18n = (word: string, lang: string) => {
|
|
12
|
+
switch (word) {
|
|
13
|
+
case 'Image':
|
|
14
|
+
switch (lang) {
|
|
15
|
+
case 'sq':
|
|
16
|
+
return 'Fotografi';
|
|
17
|
+
case 'am':
|
|
18
|
+
return 'ምስል';
|
|
19
|
+
case 'ar':
|
|
20
|
+
return 'صورة من';
|
|
21
|
+
case 'bn':
|
|
22
|
+
return 'ছবি';
|
|
23
|
+
case 'bs':
|
|
24
|
+
return 'Foto';
|
|
25
|
+
case 'bg':
|
|
26
|
+
return 'Снимка';
|
|
27
|
+
case 'zh':
|
|
28
|
+
return '图像来源';
|
|
29
|
+
case 'zh-hant':
|
|
30
|
+
return '圖片來源';
|
|
31
|
+
case 'hr':
|
|
32
|
+
return 'Foto';
|
|
33
|
+
case 'fa-af':
|
|
34
|
+
return 'عکس';
|
|
35
|
+
case 'en':
|
|
36
|
+
return 'Image';
|
|
37
|
+
case 'fr':
|
|
38
|
+
return 'Image';
|
|
39
|
+
case 'de':
|
|
40
|
+
return 'Bild';
|
|
41
|
+
case 'el':
|
|
42
|
+
return 'Εικόνα';
|
|
43
|
+
case 'ha':
|
|
44
|
+
return 'Hoto';
|
|
45
|
+
case 'hi':
|
|
46
|
+
return 'तस्वीर';
|
|
47
|
+
case 'id':
|
|
48
|
+
return 'Foto';
|
|
49
|
+
case 'sw':
|
|
50
|
+
return 'Picha';
|
|
51
|
+
case 'mk':
|
|
52
|
+
return 'Фотографија';
|
|
53
|
+
case 'ps':
|
|
54
|
+
return 'انځور';
|
|
55
|
+
case 'fa-ir':
|
|
56
|
+
return 'عکس';
|
|
57
|
+
case 'pl':
|
|
58
|
+
return 'Zdjęcie';
|
|
59
|
+
case 'pt-002':
|
|
60
|
+
return 'Foto';
|
|
61
|
+
case 'pt-br':
|
|
62
|
+
return 'Foto';
|
|
63
|
+
case 'ro':
|
|
64
|
+
return 'Imagine';
|
|
65
|
+
case 'ru':
|
|
66
|
+
return 'Фото';
|
|
67
|
+
case 'sr':
|
|
68
|
+
return 'Foto';
|
|
69
|
+
case 'es':
|
|
70
|
+
return 'Imagen';
|
|
71
|
+
case 'tr':
|
|
72
|
+
return 'Fotoğraf';
|
|
73
|
+
case 'uk':
|
|
74
|
+
return 'Фото';
|
|
75
|
+
case 'ur':
|
|
76
|
+
return 'تصویر';
|
|
77
|
+
default:
|
|
78
|
+
return 'Image';
|
|
79
|
+
}
|
|
80
|
+
default:
|
|
81
|
+
return word;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const m3u8tomp4 = (src: string) =>
|
|
86
|
+
src.replace('https://hlsvod.dw.com/i/', 'https://tvdownloaddw-a.akamaihd.net/').replace(',AVC_480x270,AVC_512x288,AVC_640x360,AVC_960x540,AVC_1280x720,AVC_1920x1080,.mp4.csmil/master.m3u8', 'AVC_1920x1080.mp4');
|
|
87
|
+
|
|
88
|
+
const processHtml = ($: CheerioAPI, contentLinks) => {
|
|
89
|
+
$('img').each((_, elem) => {
|
|
90
|
+
try {
|
|
91
|
+
const id = $(elem).attr('data-id');
|
|
92
|
+
const contentLink = contentLinks.find((item) => String(item.targetId) === id);
|
|
93
|
+
$(elem).attr({
|
|
94
|
+
title: contentLink?.name,
|
|
95
|
+
alt: contentLink?.description,
|
|
96
|
+
src: `https://static.dw.com/image/${id}_${formatId}.jpg`,
|
|
97
|
+
});
|
|
98
|
+
$(elem).removeAttr('style');
|
|
99
|
+
} catch {
|
|
100
|
+
// no-empty
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
$('video').each((_, elem) => {
|
|
104
|
+
try {
|
|
105
|
+
$(elem).attr('poster', $(elem).attr('data-posterurl'));
|
|
106
|
+
} catch {
|
|
107
|
+
// no-empty
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
$('iframe').each((_, elem) => {
|
|
111
|
+
try {
|
|
112
|
+
$(elem).attr('src', $(elem).attr('data-src'));
|
|
113
|
+
} catch {
|
|
114
|
+
// no-empty
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
$('svg').remove(); // svg will screw up in a lot of rss readers
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const processContent = (item, content) => {
|
|
121
|
+
const $text = load(content.text);
|
|
122
|
+
processHtml($text, content.contentLinks);
|
|
123
|
+
const liveblog =
|
|
124
|
+
item.type === 'liveblog' && content.posts
|
|
125
|
+
? art(path.join(__dirname, 'templates/liveblog.art'), {
|
|
126
|
+
posts: content.posts.map((post) => {
|
|
127
|
+
const $post = load(post.text);
|
|
128
|
+
processHtml($post, content.contentLinks);
|
|
129
|
+
post.text = $post.html();
|
|
130
|
+
return post;
|
|
131
|
+
}),
|
|
132
|
+
})
|
|
133
|
+
: undefined;
|
|
134
|
+
const video =
|
|
135
|
+
item.type === 'video' && content.hlsVideoSrc
|
|
136
|
+
? art(path.join(__dirname, 'templates/video.art'), {
|
|
137
|
+
hlsVideoSrc: content.hlsVideoSrc,
|
|
138
|
+
mp4VideoSrc: m3u8tomp4(content.hlsVideoSrc),
|
|
139
|
+
posterImageUrl: content.posterImageUrl,
|
|
140
|
+
})
|
|
141
|
+
: undefined;
|
|
142
|
+
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
143
|
+
teaser: content.teaser,
|
|
144
|
+
video,
|
|
145
|
+
mainImage: $text(`[data-id="${content.mainContentImageLink?.targetId}"]`).length === 0 ? content.mainContentImageLink : undefined,
|
|
146
|
+
// occasionally the text html already includes the main image, testing to see if an image with the same id exists
|
|
147
|
+
text: $text.html(),
|
|
148
|
+
liveblog,
|
|
149
|
+
imageI18n: i18n('Image', item.language),
|
|
150
|
+
formatId,
|
|
151
|
+
});
|
|
152
|
+
if (content.trackingCategories) {
|
|
153
|
+
item.category = content.trackingCategories;
|
|
154
|
+
}
|
|
155
|
+
if (content.firstPersonArray) {
|
|
156
|
+
item.author = content.firstPersonArray.map((person) => person.fullName).join(', ');
|
|
157
|
+
}
|
|
158
|
+
return item;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const processItems = async (items) => {
|
|
162
|
+
items = await Promise.all(
|
|
163
|
+
items.map((item) =>
|
|
164
|
+
cache.tryGet(item.link, async () => {
|
|
165
|
+
const response = await got(`https://www.dw.com/graph-api/${item.language}/content/${item.type}/${item.id}`);
|
|
166
|
+
const content = response.data.data.content;
|
|
167
|
+
return processContent(item, content);
|
|
168
|
+
})
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
return items;
|
|
172
|
+
};
|
package/lib/routes/ecnu/jwc.ts
CHANGED
|
@@ -13,7 +13,11 @@ export const route: Route = {
|
|
|
13
13
|
example: '/ecnu/jwc',
|
|
14
14
|
radar: [
|
|
15
15
|
{
|
|
16
|
-
source: ['www.jwc.ecnu.edu.cn'
|
|
16
|
+
source: ['www.jwc.ecnu.edu.cn'],
|
|
17
|
+
target: '/tzgg',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
source: ['www.ecnu.edu.cn'],
|
|
17
21
|
target: '/tzgg',
|
|
18
22
|
},
|
|
19
23
|
],
|
package/lib/routes/espn/news.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Route } from '@/types';
|
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
3
|
import ofetch from '@/utils/ofetch';
|
|
4
4
|
import * as cheerio from 'cheerio';
|
|
5
|
-
import path from 'path';
|
|
5
|
+
import path from 'node:path';
|
|
6
6
|
import { getCurrentPath } from '@/utils/helpers';
|
|
7
7
|
import { art } from '@/utils/render';
|
|
8
8
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
|
|
3
|
+
import cache from '@/utils/cache';
|
|
4
|
+
import got from '@/utils/got';
|
|
5
|
+
import iconv from 'iconv-lite';
|
|
6
|
+
import { load } from 'cheerio';
|
|
7
|
+
import { rootUrl, parseArticleList, parsePostList, parseArticle, parsePost } from './util';
|
|
8
|
+
|
|
9
|
+
export const handler = async (ctx) => {
|
|
10
|
+
const { params } = ctx.req.param();
|
|
11
|
+
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 5;
|
|
12
|
+
|
|
13
|
+
const decodedParams = params
|
|
14
|
+
? decodeURIComponent(params)
|
|
15
|
+
.split(/&/)
|
|
16
|
+
.filter((p) => p.split(/=/).length === 2)
|
|
17
|
+
.join('&')
|
|
18
|
+
: undefined;
|
|
19
|
+
|
|
20
|
+
const currentUrl = new URL(`forum.php${decodedParams ? `?${decodedParams}` : ''}`, rootUrl).href;
|
|
21
|
+
|
|
22
|
+
const { data: response } = await got(currentUrl, {
|
|
23
|
+
responseType: 'buffer',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const $ = load(iconv.decode(response, 'gbk'));
|
|
27
|
+
|
|
28
|
+
const language = $('meta[http-equiv="Content-Language"]').prop('content');
|
|
29
|
+
|
|
30
|
+
let items = $('table#threadlisttableid').length === 0 ? parseArticleList($, limit) : parsePostList($, limit);
|
|
31
|
+
|
|
32
|
+
items = await Promise.all(
|
|
33
|
+
items.map((item) =>
|
|
34
|
+
cache.tryGet(item.link, async () => {
|
|
35
|
+
const { data: detailResponse } = await got(item.link, {
|
|
36
|
+
responseType: 'buffer',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const $$ = load(iconv.decode(detailResponse, 'gbk').replaceAll(/<\/?ignore_js_op>/g, ''));
|
|
40
|
+
|
|
41
|
+
item = $$('div.firstpost').length === 0 ? parseArticle($$, item) : parsePost($$, item);
|
|
42
|
+
|
|
43
|
+
item.language = language;
|
|
44
|
+
|
|
45
|
+
return item;
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const image = `https:${$('div.wp h2 a img').prop('src')}`;
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
title: `飞客 - ${$('a.forum_name, li.a, li.cur, li.xw1, div.z > a.xw1')
|
|
54
|
+
.toArray()
|
|
55
|
+
.map((a) => $(a).text())
|
|
56
|
+
.join(' - ')}`,
|
|
57
|
+
description: $('meta[name="description"]').prop('content'),
|
|
58
|
+
link: currentUrl,
|
|
59
|
+
item: items,
|
|
60
|
+
allowEmpty: true,
|
|
61
|
+
image,
|
|
62
|
+
author: $('meta[name="application-name"]').prop('content'),
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const route: Route = {
|
|
67
|
+
path: '/forum/:params{.+}?',
|
|
68
|
+
name: '会员说',
|
|
69
|
+
url: 'www.flyert.com.cn',
|
|
70
|
+
maintainers: ['nczitzk'],
|
|
71
|
+
handler,
|
|
72
|
+
example: '/flyert/forum',
|
|
73
|
+
parameters: { params: '参数,默认为空,可在对应分类页 URL 中找到' },
|
|
74
|
+
description: `:::tip
|
|
75
|
+
若订阅 [酒店集团优惠](https://www.flyert.com.cn/forum.php?mod=forumdisplay&sum=all&fid=all&catid=322&filter=sortid&sortid=144&searchsort=1&youhui_type=19),网址为 \`https://www.flyert.com.cn/forum.php?mod=forumdisplay&sum=all&fid=all&catid=322&filter=sortid&sortid=144&searchsort=1&youhui_type=19\`。截取 \`https://www.flyert.com.cn/forum.php?\` 到末尾的部分 \`mod=forumdisplay&sum=all&fid=all&catid=322&filter=sortid&sortid=144&searchsort=1&youhui_type=19\` **进行 UrlEncode 编码** 后作为参数填入,此时路由为 [\`/flyert/forum/mod%3Dforumdisplay%26sum%3Dall%26fid%3Dall%26catid%3D322%26filter%3Dsortid%26sortid%3D144%26searchsort%3D1%26youhui_type%3D226\`](https://rsshub.app/flyert/forum/mod%3Dforumdisplay%26sum%3Dall%26fid%3Dall%26catid%3D322%26filter%3Dsortid%26sortid%3D144%26searchsort%3D1%26youhui_type%3D226)。
|
|
76
|
+
:::
|
|
77
|
+
`,
|
|
78
|
+
categories: ['bbs'],
|
|
79
|
+
|
|
80
|
+
features: {
|
|
81
|
+
requireConfig: false,
|
|
82
|
+
requirePuppeteer: false,
|
|
83
|
+
antiCrawler: false,
|
|
84
|
+
supportRadar: true,
|
|
85
|
+
supportBT: false,
|
|
86
|
+
supportPodcast: false,
|
|
87
|
+
supportScihub: false,
|
|
88
|
+
},
|
|
89
|
+
radar: [
|
|
90
|
+
{
|
|
91
|
+
source: ['www.flyert.com.cn/forum.php'],
|
|
92
|
+
target: (_, url) => {
|
|
93
|
+
const params = [...url.searchParams.entries()].map(([key, value]) => key + '=' + value).join('&');
|
|
94
|
+
|
|
95
|
+
return `/forum${params ? `/${encodeURIComponent(params)}` : ''}`;
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{ if images }}
|
|
2
|
+
{{ each images image }}
|
|
3
|
+
{{ if image?.src }}
|
|
4
|
+
<figure>
|
|
5
|
+
<img
|
|
6
|
+
{{ if image.alt }}
|
|
7
|
+
alt="{{ image.alt }}"
|
|
8
|
+
{{ /if }}
|
|
9
|
+
src="{{ image.src }}">
|
|
10
|
+
</figure>
|
|
11
|
+
{{ /if }}
|
|
12
|
+
{{ /each }}
|
|
13
|
+
{{ /if }}
|
|
14
|
+
|
|
15
|
+
{{ if intro }}
|
|
16
|
+
<blockquote>{{ intro }}</blockquote>
|
|
17
|
+
{{ /if }}
|
|
18
|
+
|
|
19
|
+
{{ if description }}
|
|
20
|
+
{{@ description }}
|
|
21
|
+
{{ /if }}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { getCurrentPath } from '@/utils/helpers';
|
|
2
|
+
const __dirname = getCurrentPath(import.meta.url);
|
|
3
|
+
|
|
4
|
+
import { CheerioAPI } from 'cheerio';
|
|
5
|
+
import timezone from '@/utils/timezone';
|
|
6
|
+
import { parseDate } from '@/utils/parse-date';
|
|
7
|
+
import { art } from '@/utils/render';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
|
|
10
|
+
const rootUrl = 'https://www.flyert.com.cn';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parses a list of articles based on a CheerioAPI object and a limit.
|
|
14
|
+
* @param $ The CheerioAPI object.
|
|
15
|
+
* @param limit The maximum number of articles to parse.
|
|
16
|
+
* @returns An array of parsed article objects.
|
|
17
|
+
*/
|
|
18
|
+
const parseArticleList = ($: CheerioAPI, limit: number) =>
|
|
19
|
+
$('div.comiis_wzli')
|
|
20
|
+
.slice(0, limit)
|
|
21
|
+
.toArray()
|
|
22
|
+
.map((item) => {
|
|
23
|
+
item = $(item);
|
|
24
|
+
|
|
25
|
+
const title = item.find('div.wzbt').text().trim();
|
|
26
|
+
const image = item.find('div.wzpic img').prop('src');
|
|
27
|
+
const description = art(path.join(__dirname, 'templates/description.art'), {
|
|
28
|
+
images: image
|
|
29
|
+
? [
|
|
30
|
+
{
|
|
31
|
+
src: image,
|
|
32
|
+
alt: title,
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
: undefined,
|
|
36
|
+
description: item.find('div.wznr').html(),
|
|
37
|
+
});
|
|
38
|
+
const pubDate = item.find('div.subcat span.y').contents()?.eq(2)?.text().trim() ?? undefined;
|
|
39
|
+
const link = new URL(item.find('div.wzbt a').prop('href'), rootUrl).href;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
title,
|
|
43
|
+
description,
|
|
44
|
+
pubDate: pubDate ? parseDate(pubDate) : undefined,
|
|
45
|
+
link,
|
|
46
|
+
author: item.find('div.subcat span.y a').first().text(),
|
|
47
|
+
content: {
|
|
48
|
+
html: description,
|
|
49
|
+
text: item.find('div.wznr').text(),
|
|
50
|
+
},
|
|
51
|
+
image,
|
|
52
|
+
banner: image,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Parses a list of posts based on a CheerioAPI object and a limit.
|
|
58
|
+
* @param $ The CheerioAPI object.
|
|
59
|
+
* @param limit The maximum number of posts to parse.
|
|
60
|
+
* @returns An array of parsed post objects.
|
|
61
|
+
*/
|
|
62
|
+
const parsePostList = ($: CheerioAPI, limit: number) =>
|
|
63
|
+
$('div.comiis_postlist')
|
|
64
|
+
.toArray()
|
|
65
|
+
.filter((item) => {
|
|
66
|
+
item = $(item);
|
|
67
|
+
|
|
68
|
+
return item
|
|
69
|
+
.find('span.comiis_common a[data-track]')
|
|
70
|
+
.toArray()
|
|
71
|
+
.some((a) => {
|
|
72
|
+
a = $(a);
|
|
73
|
+
|
|
74
|
+
const dataTrack = a.attr('data-track') || '';
|
|
75
|
+
return dataTrack.endsWith('文章');
|
|
76
|
+
});
|
|
77
|
+
})
|
|
78
|
+
.slice(0, limit)
|
|
79
|
+
.map((item) => {
|
|
80
|
+
item = $(item);
|
|
81
|
+
|
|
82
|
+
const aEl = $(
|
|
83
|
+
item
|
|
84
|
+
.find('span.comiis_common a[data-track]')
|
|
85
|
+
.toArray()
|
|
86
|
+
.find((a) => {
|
|
87
|
+
a = $(a);
|
|
88
|
+
|
|
89
|
+
const dataTrack = a.attr('data-track') || '';
|
|
90
|
+
return dataTrack.endsWith('文章');
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const pubDate = item.find('span.author_b span').prop('title') || undefined;
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
title: aEl.text().trim(),
|
|
98
|
+
pubDate: pubDate ? parseDate(pubDate) : undefined,
|
|
99
|
+
link: new URL(aEl.prop('href'), rootUrl).href,
|
|
100
|
+
author: item.find('a.author_t').text().trim(),
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Parses an article based on a CheerioAPI object and an item.
|
|
106
|
+
* @param $$ The CheerioAPI object.
|
|
107
|
+
* @param item The item to parse.
|
|
108
|
+
* @returns The parsed article object.
|
|
109
|
+
*/
|
|
110
|
+
const parseArticle = ($$: CheerioAPI, item) => {
|
|
111
|
+
const title = $$('h1.ph').text().trim();
|
|
112
|
+
const description = art(path.join(__dirname, 'templates/description.art'), {
|
|
113
|
+
intro: $$('div.s').text() || undefined,
|
|
114
|
+
description: $$('div#artMain').html(),
|
|
115
|
+
});
|
|
116
|
+
const pubDate =
|
|
117
|
+
$$('p.xg1')
|
|
118
|
+
.contents()
|
|
119
|
+
.first()
|
|
120
|
+
.text()
|
|
121
|
+
.trim()
|
|
122
|
+
?.match(/(\d{4}-\d{1,2}-\d{1,2}\s\d{2}:\d{2})/)?.[1] ?? undefined;
|
|
123
|
+
const guid = `flyert-${item.link.split(/=/).pop()}`;
|
|
124
|
+
|
|
125
|
+
item.title = title;
|
|
126
|
+
item.description = description;
|
|
127
|
+
item.pubDate = pubDate ? timezone(parseDate(pubDate), +8) : item.pubDate;
|
|
128
|
+
item.author = $$('p.xg1 a').first().text();
|
|
129
|
+
item.guid = guid;
|
|
130
|
+
item.id = guid;
|
|
131
|
+
item.content = {
|
|
132
|
+
html: description,
|
|
133
|
+
text: $$('div#artMain').text(),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return item;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Parses a post based on a CheerioAPI object and an item.
|
|
141
|
+
* @param $$ The CheerioAPI object.
|
|
142
|
+
* @param item The item to parse.
|
|
143
|
+
* @returns The parsed post object.
|
|
144
|
+
*/
|
|
145
|
+
const parsePost = ($$: CheerioAPI, item) => {
|
|
146
|
+
$$('img.zoom').each((_, el) => {
|
|
147
|
+
el = $$(el);
|
|
148
|
+
|
|
149
|
+
el.replaceWith(
|
|
150
|
+
art(path.join(__dirname, 'templates/description.art'), {
|
|
151
|
+
images:
|
|
152
|
+
el.prop('zoomfile') || el.prop('file')
|
|
153
|
+
? [
|
|
154
|
+
{
|
|
155
|
+
src: el.prop('zoomfile') || el.prop('file'),
|
|
156
|
+
alt: el.prop('alt') || el.prop('title'),
|
|
157
|
+
},
|
|
158
|
+
]
|
|
159
|
+
: undefined,
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
$$('i.pstatus').remove();
|
|
165
|
+
$$('div.tip').remove();
|
|
166
|
+
|
|
167
|
+
const title = $$('span#thread_subject').text().trim();
|
|
168
|
+
const description = $$('div.post_message').first().html();
|
|
169
|
+
const pubDate = $$('span[title]').first().prop('title');
|
|
170
|
+
|
|
171
|
+
const tid = item.link.match(/tid=(\d+)/)?.[1] ?? undefined;
|
|
172
|
+
const guid = tid ? `flyert-${tid}` : undefined;
|
|
173
|
+
|
|
174
|
+
item.title = title;
|
|
175
|
+
item.description = description;
|
|
176
|
+
item.pubDate = pubDate ? timezone(parseDate(pubDate), +8) : item.pubDate;
|
|
177
|
+
item.author = $$('a.kmxi2').first().text();
|
|
178
|
+
item.guid = guid;
|
|
179
|
+
item.id = guid;
|
|
180
|
+
item.content = {
|
|
181
|
+
html: description,
|
|
182
|
+
text: $$('div.post_message').first().text(),
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return item;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export { rootUrl, parseArticleList, parsePostList, parseArticle, parsePost };
|
|
@@ -19,7 +19,7 @@ export const route: Route = {
|
|
|
19
19
|
},
|
|
20
20
|
],
|
|
21
21
|
handler,
|
|
22
|
-
maintainers: ['KarasuShin', 'DIYgod'],
|
|
22
|
+
maintainers: ['KarasuShin', 'DIYgod', 'DFobain'],
|
|
23
23
|
features: {
|
|
24
24
|
supportRadar: true,
|
|
25
25
|
},
|
|
@@ -64,7 +64,7 @@ async function handler(ctx: Context): Promise<Data> {
|
|
|
64
64
|
category: subscription.category ? [subscription.category] : undefined,
|
|
65
65
|
};
|
|
66
66
|
}),
|
|
67
|
-
link: `https://app.follow.is/share/
|
|
67
|
+
link: `https://app.follow.is/share/users/${handleOrId}`,
|
|
68
68
|
image: profile.data.image,
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -3,7 +3,7 @@ import { rootUrl, apiRootUrl, processItems, icon, image } from './util';
|
|
|
3
3
|
|
|
4
4
|
export const route: Route = {
|
|
5
5
|
path: '/column/:id',
|
|
6
|
-
categories: ['new-media'],
|
|
6
|
+
categories: ['new-media', 'popular'],
|
|
7
7
|
example: '/foresightnews/column/1',
|
|
8
8
|
parameters: { id: '专栏 id, 可在对应专栏页 URL 中找到' },
|
|
9
9
|
features: {
|