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,73 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import * as cheerio from 'cheerio';
|
|
4
|
+
import { parseDate } from '@/utils/parse-date';
|
|
5
|
+
import cache from '@/utils/cache';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/latest',
|
|
9
|
+
categories: ['new-media'],
|
|
10
|
+
example: '/vertikal/latest',
|
|
11
|
+
radar: [
|
|
12
|
+
{
|
|
13
|
+
source: ['vertikal.net/en/news', 'vertikal.net'],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
name: 'News Archive',
|
|
17
|
+
maintainers: ['TonyRL'],
|
|
18
|
+
handler,
|
|
19
|
+
url: 'vertikal.net/en/news',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const baseUrl = 'https://vertikal.net';
|
|
23
|
+
|
|
24
|
+
async function handler() {
|
|
25
|
+
const response = await ofetch(`${baseUrl}/en/homepage/async-news-loader`, {
|
|
26
|
+
query: {
|
|
27
|
+
perPage: 24,
|
|
28
|
+
page: 1,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const $ = cheerio.load(response);
|
|
32
|
+
|
|
33
|
+
const list = $('.grid__column')
|
|
34
|
+
.toArray()
|
|
35
|
+
.map((item) => {
|
|
36
|
+
const $item = $(item);
|
|
37
|
+
return {
|
|
38
|
+
title: $item.find('.news-teaser__title').text(),
|
|
39
|
+
link: `${baseUrl}${$item.find('.news-teaser').attr('href')}`,
|
|
40
|
+
pubDate: parseDate($item.find('.news-teaser__date').text(), 'DD.MM.YYYY'),
|
|
41
|
+
description: $item.find('.news-teaser__text').text(),
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const items = await Promise.all(
|
|
46
|
+
list.map((item) =>
|
|
47
|
+
cache.tryGet(item.link, async () => {
|
|
48
|
+
const response = await ofetch(item.link);
|
|
49
|
+
const $ = cheerio.load(response);
|
|
50
|
+
|
|
51
|
+
const content = $('.newsentry');
|
|
52
|
+
|
|
53
|
+
item.category = content
|
|
54
|
+
.find('.newsentry__tags a')
|
|
55
|
+
.toArray()
|
|
56
|
+
.map((tag) => $(tag).text().trim());
|
|
57
|
+
|
|
58
|
+
content.find('.newsentry__date, .newsentry__title, .lazyimage-placeholder, .newsentry__tags, .newsentry__share, .newsentry__comments, .newsentry__write-comment').remove();
|
|
59
|
+
|
|
60
|
+
item.description = content.html();
|
|
61
|
+
|
|
62
|
+
return item;
|
|
63
|
+
})
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
title: 'News Archive | Vertikal.net',
|
|
69
|
+
link: `${baseUrl}/en/news`,
|
|
70
|
+
image: `${baseUrl}/apple-touch-icon-152x152.png`,
|
|
71
|
+
item: items,
|
|
72
|
+
};
|
|
73
|
+
}
|
package/lib/routes/vice/topic.ts
CHANGED
|
@@ -3,7 +3,7 @@ import ofetch from '@/utils/ofetch';
|
|
|
3
3
|
import { load } from 'cheerio';
|
|
4
4
|
import { parseDate } from '@/utils/parse-date';
|
|
5
5
|
import cache from '@/utils/cache';
|
|
6
|
-
import path from 'path';
|
|
6
|
+
import path from 'node:path';
|
|
7
7
|
import { getCurrentPath } from '@/utils/helpers';
|
|
8
8
|
import { art } from '@/utils/render';
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import { processList, ProcessFeed, baseUrl, apiUrl } from './utils';
|
|
|
5
5
|
|
|
6
6
|
export const route: Route = {
|
|
7
7
|
path: '/publication/:id',
|
|
8
|
-
categories: ['social-media'],
|
|
8
|
+
categories: ['social-media', 'popular'],
|
|
9
9
|
example: '/vocus/publication/bass',
|
|
10
10
|
parameters: { id: '出版專題 id,可在出版專題主页的 URL 找到' },
|
|
11
11
|
features: {
|
package/lib/routes/vocus/user.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { processList, ProcessFeed, baseUrl, apiUrl } from './utils';
|
|
|
5
5
|
|
|
6
6
|
export const route: Route = {
|
|
7
7
|
path: '/user/:id',
|
|
8
|
-
categories: ['social-media'],
|
|
8
|
+
categories: ['social-media', 'popular'],
|
|
9
9
|
example: '/vocus/user/tsetyan',
|
|
10
10
|
parameters: { id: '用户 id,可在用户主页的 URL 找到' },
|
|
11
11
|
features: {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import { parseDate } from '@/utils/parse-date';
|
|
4
|
+
|
|
5
|
+
export const route: Route = {
|
|
6
|
+
path: '/calendar/:section?',
|
|
7
|
+
categories: ['finance'],
|
|
8
|
+
example: '/wallstreetcn/calendar',
|
|
9
|
+
parameters: { section: '`macrodatas` 或 `report`,默认为 `macrodatas`' },
|
|
10
|
+
features: {
|
|
11
|
+
requireConfig: false,
|
|
12
|
+
requirePuppeteer: false,
|
|
13
|
+
antiCrawler: false,
|
|
14
|
+
supportBT: false,
|
|
15
|
+
supportPodcast: false,
|
|
16
|
+
supportScihub: false,
|
|
17
|
+
},
|
|
18
|
+
radar: [
|
|
19
|
+
{
|
|
20
|
+
source: ['wallstreetcn.com/calendar'],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
name: '财经日历',
|
|
24
|
+
maintainers: ['TonyRL'],
|
|
25
|
+
handler,
|
|
26
|
+
url: 'wallstreetcn.com/calendar',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const rootUrl = 'https://wallstreetcn.com';
|
|
30
|
+
|
|
31
|
+
const MacrodataSuffix = {
|
|
32
|
+
CA: 'CA10YR.OTC',
|
|
33
|
+
CN: 'USDCNH.OTC',
|
|
34
|
+
DE: 'DE30.OTC',
|
|
35
|
+
FR: 'FR40.OTC',
|
|
36
|
+
// HK: '',
|
|
37
|
+
IT: 'EURUSD.OTC',
|
|
38
|
+
JP: 'USDJPY.OTC',
|
|
39
|
+
UK: 'UK100.OTC',
|
|
40
|
+
US: 'DXY.OTC',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const getMacrodataUrl = (countryId, wscnTicker) => `${rootUrl}/data-analyse/${wscnTicker}/${MacrodataSuffix[countryId]}`;
|
|
44
|
+
|
|
45
|
+
async function handler(ctx) {
|
|
46
|
+
const { section = 'macrodatas' } = ctx.req.param();
|
|
47
|
+
|
|
48
|
+
const link = `${rootUrl}/calendar`;
|
|
49
|
+
const apiRootUrl = section === 'macrodatas' ? 'https://api-one-wscn.awtmt.com' : 'https://api-ddc-wscn.awtmt.com';
|
|
50
|
+
const apiUrl = section === 'macrodatas' ? `${apiRootUrl}/apiv1/finance/macrodatas` : `${apiRootUrl}/finance/report/list`;
|
|
51
|
+
|
|
52
|
+
const response = await ofetch(apiUrl, {
|
|
53
|
+
query:
|
|
54
|
+
section === 'macrodatas'
|
|
55
|
+
? {
|
|
56
|
+
start: new Date().setHours(0, 0, 0, 0) / 1000,
|
|
57
|
+
end: Math.trunc(new Date().setHours(23, 59, 59, 999) / 1000),
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const items =
|
|
63
|
+
section === 'macrodatas'
|
|
64
|
+
? response.data.items.map((item) => ({
|
|
65
|
+
title: `${item.country}${item.title}`,
|
|
66
|
+
description: `${item.country}${item.title} 重要性: ${'★'.repeat(item.importance)} 今值: ${item.actual || '-'}${item.actual && item.unit} 预期: ${item.forecast || '-'}${item.forecast && item.unit} 前值: ${item.revised || item.previous || '-'}${(item.revised || item.previous) && item.unit}`,
|
|
67
|
+
link: item.uri && MacrodataSuffix[item.country_id] && getMacrodataUrl(item.country_id, item.wscn_ticker),
|
|
68
|
+
guid: item.id,
|
|
69
|
+
pubDate: parseDate(item.public_date, 'X'),
|
|
70
|
+
category: item.country,
|
|
71
|
+
}))
|
|
72
|
+
: // report
|
|
73
|
+
response.data.items
|
|
74
|
+
.map((item) => Object.fromEntries(response.data.fields.map((field, index) => [field, item[index]])))
|
|
75
|
+
.map((item) => ({
|
|
76
|
+
title: `${item.company_name} ${item.observation_date}`,
|
|
77
|
+
description: `${item.code} ${item.company_name} ${item.observation_date} 预期EPS: ${item.eps_estimate === 0 ? '-' : item.eps_estimate} 实际EPS: ${item.reported_eps === 0 ? '-' : item.reported_eps} 差异度: ${item.surprise === 0 || item.surprise === -1 ? '-' : (item.surprise * 100).toFixed(2) + '%'}`,
|
|
78
|
+
link,
|
|
79
|
+
guid: item.id,
|
|
80
|
+
pubDate: parseDate(item.public_date, 'X'),
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
title: '财经日历 - 华尔街见闻',
|
|
85
|
+
link,
|
|
86
|
+
item: items,
|
|
87
|
+
itunes_author: '华尔街见闻',
|
|
88
|
+
image: 'https://static.wscn.net/wscn/_static/favicon.png',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
|
|
|
5
5
|
|
|
6
6
|
export const route: Route = {
|
|
7
7
|
path: '/hot/:period?',
|
|
8
|
-
categories: ['
|
|
8
|
+
categories: ['finance'],
|
|
9
9
|
example: '/wallstreetcn/hot',
|
|
10
10
|
parameters: { period: '时期,可选 `day` 即 当日 或 `week` 即 当周,默认为当日' },
|
|
11
11
|
features: {
|
|
@@ -77,6 +77,6 @@ async function handler(ctx) {
|
|
|
77
77
|
link: rootUrl,
|
|
78
78
|
item: items,
|
|
79
79
|
itunes_author: '华尔街见闻',
|
|
80
|
-
image: 'https://static
|
|
80
|
+
image: 'https://static.wscn.net/wscn/_static/favicon.png',
|
|
81
81
|
};
|
|
82
82
|
}
|
|
@@ -19,7 +19,7 @@ const titles = {
|
|
|
19
19
|
|
|
20
20
|
export const route: Route = {
|
|
21
21
|
path: '/live/:category?/:score?',
|
|
22
|
-
categories: ['
|
|
22
|
+
categories: ['finance'],
|
|
23
23
|
example: '/wallstreetcn/live',
|
|
24
24
|
parameters: { category: '快讯分类,默认`global`,见下表', score: '快讯重要度,默认`1`全部快讯,可设置为`2`只看重要的' },
|
|
25
25
|
features: {
|
|
@@ -18,13 +18,15 @@ const titles = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const route: Route = {
|
|
21
|
-
path:
|
|
21
|
+
path: '/news/:category?',
|
|
22
|
+
categories: ['finance'],
|
|
23
|
+
example: '/wallstreetcn/news',
|
|
22
24
|
radar: [
|
|
23
25
|
{
|
|
24
26
|
source: ['wallstreetcn.com/news/:category', 'wallstreetcn.com/'],
|
|
25
27
|
},
|
|
26
28
|
],
|
|
27
|
-
name: '
|
|
29
|
+
name: '资讯',
|
|
28
30
|
maintainers: ['nczitzk'],
|
|
29
31
|
handler,
|
|
30
32
|
description: `| id | 分类 |
|
|
@@ -98,6 +100,6 @@ async function handler(ctx) {
|
|
|
98
100
|
link: currentUrl,
|
|
99
101
|
item: items,
|
|
100
102
|
itunes_author: '华尔街见闻',
|
|
101
|
-
image: 'https://static
|
|
103
|
+
image: 'https://static.wscn.net/wscn/_static/favicon.png',
|
|
102
104
|
};
|
|
103
105
|
}
|
|
@@ -95,7 +95,8 @@ async function handler(ctx) {
|
|
|
95
95
|
ctx.set({
|
|
96
96
|
'Cache-Control': 'no-cache',
|
|
97
97
|
});
|
|
98
|
-
ctx.redirect
|
|
98
|
+
ctx.set('redirect', `https://api.weibo.com/oauth2/authorize?client_id=${app_key}&redirect_uri=${redirect_url}${routeParams ? `&state=${routeParams}` : ''}`);
|
|
99
|
+
return;
|
|
99
100
|
}
|
|
100
101
|
const resultItem = await Promise.all(
|
|
101
102
|
response.statuses.map(async (item) => {
|
|
@@ -183,6 +184,6 @@ async function handler(ctx) {
|
|
|
183
184
|
ctx.set({
|
|
184
185
|
'Cache-Control': 'no-cache',
|
|
185
186
|
});
|
|
186
|
-
ctx.redirect
|
|
187
|
+
ctx.set('redirect', `https://api.weibo.com/oauth2/authorize?client_id=${app_key}&redirect_uri=${redirect_url}${routeParams ? `&state=${feature}/${routeParams.replaceAll('&', '%26')}` : ''}`);
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -7,7 +7,7 @@ import { parseDate } from '@/utils/parse-date';
|
|
|
7
7
|
import { baseUrl, getCitys, getDistricts } from './utils';
|
|
8
8
|
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
|
9
9
|
import { art } from '@/utils/render';
|
|
10
|
-
import path from 'path';
|
|
10
|
+
import path from 'node:path';
|
|
11
11
|
import { getCurrentPath } from '@/utils/helpers';
|
|
12
12
|
|
|
13
13
|
const __dirname = getCurrentPath(import.meta.url);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Route, Data, DataItem } from '@/types';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
import cache from '@/utils/cache';
|
|
4
|
+
import got from '@/utils/got';
|
|
5
|
+
|
|
6
|
+
const apiUrl = 'https://wufazhuce.com/';
|
|
7
|
+
const NAME = '「ONE · 一个」';
|
|
8
|
+
|
|
9
|
+
export const route: Route = {
|
|
10
|
+
path: '/one',
|
|
11
|
+
categories: ['new-media'],
|
|
12
|
+
example: '/wufazhuce/one',
|
|
13
|
+
features: {
|
|
14
|
+
requireConfig: false,
|
|
15
|
+
requirePuppeteer: false,
|
|
16
|
+
antiCrawler: false,
|
|
17
|
+
supportBT: false,
|
|
18
|
+
supportPodcast: false,
|
|
19
|
+
supportScihub: false,
|
|
20
|
+
},
|
|
21
|
+
radar: [
|
|
22
|
+
{
|
|
23
|
+
source: ['wufazhuce.com'],
|
|
24
|
+
target: '/one',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
name: NAME,
|
|
28
|
+
maintainers: ['sicheng1806'],
|
|
29
|
+
handler,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
async function handler(): Promise<Data> {
|
|
33
|
+
const resp = await got(apiUrl);
|
|
34
|
+
const $ = load(resp.body);
|
|
35
|
+
let items: DataItem[] = [
|
|
36
|
+
...$('#carousel-one div.item')
|
|
37
|
+
.toArray()
|
|
38
|
+
.map((item) => {
|
|
39
|
+
const a = $(item).find('.fp-one-cita a').first();
|
|
40
|
+
return {
|
|
41
|
+
title: a.text(),
|
|
42
|
+
link: a.attr('href'),
|
|
43
|
+
description: '',
|
|
44
|
+
category: '摄影',
|
|
45
|
+
};
|
|
46
|
+
}),
|
|
47
|
+
...$('.fp-one-articulo a')
|
|
48
|
+
.toArray()
|
|
49
|
+
.map((item) => {
|
|
50
|
+
const a = $(item);
|
|
51
|
+
return {
|
|
52
|
+
title: a.text(),
|
|
53
|
+
link: a.attr('href'),
|
|
54
|
+
description: '',
|
|
55
|
+
category: '文章',
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
...$('.fp-one-cuestion a')
|
|
59
|
+
.toArray()
|
|
60
|
+
.map((item) => {
|
|
61
|
+
const a = $(item);
|
|
62
|
+
return {
|
|
63
|
+
title: a.text(),
|
|
64
|
+
link: a.attr('href'),
|
|
65
|
+
description: '',
|
|
66
|
+
category: '问题',
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
// 添加全文
|
|
72
|
+
items = await Promise.all(
|
|
73
|
+
items.map((item: DataItem) =>
|
|
74
|
+
cache.tryGet(item.link, async () => {
|
|
75
|
+
const rsp = await got(item.link);
|
|
76
|
+
const content = load(rsp.body);
|
|
77
|
+
item.description = content('.tab-content').html() || '';
|
|
78
|
+
return item;
|
|
79
|
+
})
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// 生成rss
|
|
84
|
+
return {
|
|
85
|
+
title: NAME,
|
|
86
|
+
link: apiUrl,
|
|
87
|
+
item: items,
|
|
88
|
+
description: '复杂世界里, 一个就够了. One is all.',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
|
-
import
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import { calculate } from './util';
|
|
3
4
|
|
|
4
5
|
export const route: Route = {
|
|
5
6
|
path: '/discount/:platform',
|
|
@@ -23,20 +24,59 @@ export const route: Route = {
|
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const PLATFORM_MAP = {
|
|
26
|
-
pc:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
pc: {
|
|
28
|
+
key: 'pc',
|
|
29
|
+
desc: 'PC',
|
|
30
|
+
},
|
|
31
|
+
switch: {
|
|
32
|
+
key: 'switch',
|
|
33
|
+
desc: 'Switch',
|
|
34
|
+
},
|
|
35
|
+
psn: {
|
|
36
|
+
key: 'ps4',
|
|
37
|
+
desc: 'PSN',
|
|
38
|
+
},
|
|
39
|
+
xbox: {
|
|
40
|
+
key: 'xbox',
|
|
41
|
+
desc: 'Xbox',
|
|
42
|
+
},
|
|
30
43
|
};
|
|
31
44
|
|
|
45
|
+
function getDiscountDesc(discount) {
|
|
46
|
+
return `${(100 - discount) / 10}折`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getLowestDesc(priceInfo, isSuperLowest = false) {
|
|
50
|
+
if (!('is_lowest' in priceInfo) || priceInfo.is_lowest === 0) {
|
|
51
|
+
return '';
|
|
52
|
+
} else if (isSuperLowest) {
|
|
53
|
+
return '[超史低]';
|
|
54
|
+
} else if (priceInfo.is_lowest && priceInfo.is_lowest === 1 && priceInfo.new_lowest && priceInfo.new_lowest === 1) {
|
|
55
|
+
return '[新史低]';
|
|
56
|
+
} else if (priceInfo.is_lowest && priceInfo.is_lowest === 1) {
|
|
57
|
+
return '[史低]';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getHeyboxPriceDesc(heyboxPriceInfo) {
|
|
62
|
+
if (heyboxPriceInfo.coupon_info) {
|
|
63
|
+
let discountPrice = heyboxPriceInfo.cost_coin / 1000;
|
|
64
|
+
discountPrice = discountPrice - heyboxPriceInfo.coupon_info.max_reduce;
|
|
65
|
+
const formatPrice = Number.isInteger(discountPrice) ? discountPrice.toFixed(0) : discountPrice.toFixed(2);
|
|
66
|
+
return `| 券后价: ${formatPrice} [${heyboxPriceInfo.coupon_info.coupon_desc}]`;
|
|
67
|
+
} else {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
32
72
|
async function handler(ctx) {
|
|
33
|
-
const
|
|
73
|
+
const platformInfo = PLATFORM_MAP[ctx.req.param('platform')];
|
|
34
74
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const data = response.
|
|
75
|
+
const dataUrl = calculate(
|
|
76
|
+
`https://api.xiaoheihe.cn/game/get_game_list_v3/?filter_head=${platformInfo.key}&offset=0&limit=30&os_type=web&app=heybox&client_type=mobile&version=999.0.3&x_client_type=web&x_os_type=Mac&x_app=heybox&heybox_id=-1&include_filter=-1`
|
|
77
|
+
);
|
|
78
|
+
const response = await ofetch(dataUrl);
|
|
79
|
+
const data = response.result.games;
|
|
40
80
|
|
|
41
81
|
const items = data.map((item) => {
|
|
42
82
|
const title = `${item.name}${item.name_en ? '/' + item.name_en : ''}`;
|
|
@@ -47,44 +87,48 @@ async function handler(ctx) {
|
|
|
47
87
|
for (const platform of item.platform_infos) {
|
|
48
88
|
if (platform.price) {
|
|
49
89
|
if (platform.key) {
|
|
50
|
-
description += `平台: ${platform.key}<br
|
|
90
|
+
description += `平台: ${platform.key.toUpperCase()}<br/>`;
|
|
51
91
|
}
|
|
52
92
|
if (platform.price.current) {
|
|
53
|
-
description += `当前价格: ${platform.price.current}${platform.price
|
|
93
|
+
description += `当前价格: ${platform.price.current} ${getLowestDesc(platform.price)}<br/>`;
|
|
54
94
|
}
|
|
55
95
|
if (platform.price.initial) {
|
|
56
96
|
description += `原价: ${platform.price.initial}<br/>`;
|
|
57
97
|
}
|
|
58
|
-
if (platform.price.
|
|
59
|
-
description += `折扣力度: ${platform.price.
|
|
98
|
+
if (platform.price.discount && platform.price.discount > 0) {
|
|
99
|
+
description += `折扣力度: ${getDiscountDesc(platform.price.discount)}<br/>`;
|
|
60
100
|
}
|
|
61
101
|
if (platform.price.deadline_date) {
|
|
62
102
|
description += `截止时间: ${platform.price.deadline_date}<br/>`;
|
|
63
103
|
}
|
|
64
|
-
description += '<br/>';
|
|
65
104
|
}
|
|
66
105
|
}
|
|
67
106
|
} else {
|
|
68
107
|
if (item.price) {
|
|
69
|
-
description += `平台: ${
|
|
70
|
-
if (item.
|
|
71
|
-
description +=
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const current = Math.round((item.price.initial * (100 - item.price.discount)) / 100);
|
|
75
|
-
description += `当前价格: ${current}${item.price.discount === item.price.lowest_discount ? '[史低]' : ''} `;
|
|
108
|
+
description += `平台: ${platformInfo.desc}<br/>`;
|
|
109
|
+
if (item.heybox_price) {
|
|
110
|
+
description += `当前价格: ${item.price.current} ${getHeyboxPriceDesc(item.heybox_price)} ${getLowestDesc(item.price, item.heybox_price.super_lowest)}<br/>`;
|
|
111
|
+
} else if (item.price.current) {
|
|
112
|
+
description += `当前价格: ${item.price.current} ${getLowestDesc(item.price)}<br/>`;
|
|
76
113
|
}
|
|
77
114
|
if (item.price.initial) {
|
|
78
115
|
description += `原价: ${item.price.initial}<br/>`;
|
|
79
116
|
}
|
|
80
|
-
if (item.
|
|
81
|
-
description +=
|
|
117
|
+
if (item.price.discount && item.price.discount > 0) {
|
|
118
|
+
description += `折扣力度: ${getDiscountDesc(item.price.discount)}<br/>`;
|
|
119
|
+
}
|
|
120
|
+
if (item.price.deadline_date) {
|
|
121
|
+
description += `截止时间: ${item.price.deadline_date}<br/>`;
|
|
82
122
|
}
|
|
83
|
-
description += '<br/>';
|
|
84
123
|
}
|
|
85
124
|
}
|
|
125
|
+
if (item.score) {
|
|
126
|
+
description += `评分: ${item.score}<br/>`;
|
|
127
|
+
}
|
|
128
|
+
description += '<br/>';
|
|
129
|
+
|
|
86
130
|
let link = `https://api.xiaoheihe.cn/game/share_game_detail?appid=${item.steam_appid}`;
|
|
87
|
-
if (
|
|
131
|
+
if (platformInfo.key === 'pc') {
|
|
88
132
|
link = `https://store.steampowered.com/app/${item.steam_appid}`;
|
|
89
133
|
}
|
|
90
134
|
return {
|
|
@@ -95,7 +139,7 @@ async function handler(ctx) {
|
|
|
95
139
|
});
|
|
96
140
|
|
|
97
141
|
return {
|
|
98
|
-
title: `小黑盒 ${
|
|
142
|
+
title: `小黑盒 ${platformInfo.desc} 游戏折扣`,
|
|
99
143
|
link: `https://xiaoheihe.cn`,
|
|
100
144
|
item: items,
|
|
101
145
|
};
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import { Route, ViewType } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
|
-
import { getUser } from './util';
|
|
3
|
+
import { getUser, renderNotesFulltext, getUserWithCookie } from './util';
|
|
4
4
|
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
|
5
|
+
import { config } from '@/config';
|
|
5
6
|
|
|
6
7
|
export const route: Route = {
|
|
7
8
|
path: '/user/:user_id/:category',
|
|
8
|
-
name: '
|
|
9
|
+
name: '用户笔记/收藏',
|
|
9
10
|
categories: ['social-media', 'popular'],
|
|
10
11
|
view: ViewType.Articles,
|
|
11
|
-
maintainers: ['lotosbin'],
|
|
12
|
+
maintainers: ['lotosbin', 'howerhe', 'rien7', 'dddaniel1', 'pseudoyu'],
|
|
12
13
|
handler,
|
|
14
|
+
radar: [
|
|
15
|
+
{
|
|
16
|
+
source: ['xiaohongshu.com/user/profile/:user_id'],
|
|
17
|
+
target: '/user/:user_id/notes',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
13
20
|
example: '/xiaohongshu/user/593032945e87e77791e03696/notes',
|
|
14
21
|
features: {
|
|
15
22
|
antiCrawler: true,
|
|
16
23
|
requirePuppeteer: true,
|
|
24
|
+
requireConfig: [
|
|
25
|
+
{
|
|
26
|
+
name: 'XIAOHONGSHU_COOKIE',
|
|
27
|
+
optional: true,
|
|
28
|
+
description: '小红书 cookie 值,可在网络里面看到。',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
17
31
|
},
|
|
18
32
|
parameters: {
|
|
19
33
|
user_id: 'user id, length 24 characters',
|
|
@@ -37,7 +51,30 @@ async function handler(ctx) {
|
|
|
37
51
|
const userId = ctx.req.param('user_id');
|
|
38
52
|
const category = ctx.req.param('category');
|
|
39
53
|
const url = `https://www.xiaohongshu.com/user/profile/${userId}`;
|
|
54
|
+
const cookie = config.xiaohongshu.cookie;
|
|
55
|
+
|
|
56
|
+
if (cookie && category === 'notes') {
|
|
57
|
+
try {
|
|
58
|
+
const urlNotePrefix = 'https://www.xiaohongshu.com/explore';
|
|
59
|
+
const user = await getUserWithCookie(url, cookie);
|
|
60
|
+
const notes = await renderNotesFulltext(user.notes, urlNotePrefix);
|
|
61
|
+
return {
|
|
62
|
+
title: `${user.userPageData.basicInfo.nickname} - 笔记 • 小红书 / RED`,
|
|
63
|
+
description: user.userPageData.basicInfo.desc,
|
|
64
|
+
image: user.userPageData.basicInfo.imageb || user.userPageData.basicInfo.images,
|
|
65
|
+
link: url,
|
|
66
|
+
item: notes,
|
|
67
|
+
};
|
|
68
|
+
} catch {
|
|
69
|
+
// Fallback to normal logic if cookie method fails
|
|
70
|
+
return await getUserFeeds(url, category);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
return await getUserFeeds(url, category);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
40
76
|
|
|
77
|
+
async function getUserFeeds(url: string, category: string) {
|
|
41
78
|
const {
|
|
42
79
|
userPageData: { basicInfo, interactions, tags },
|
|
43
80
|
notes,
|