koishi-plugin-kkk 1.0.0
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/CHANGELOG.md +57 -0
- package/LICENSE +674 -0
- package/README.md +98 -0
- package/assets/web/assets/CronEditor-CYgFpX-g.js +1 -0
- package/assets/web/assets/DesktopLayout-iI43ij11.js +1 -0
- package/assets/web/assets/MobileLayout-CziU8MCR.js +1 -0
- package/assets/web/assets/ThemeSwitch-DFohhwd9.js +1 -0
- package/assets/web/assets/index-BRROK0vh.js +47 -0
- package/assets/web/assets/index-Dj-StEiS.css +2 -0
- package/assets/web/assets/separator-CxcFlCzz.js +1 -0
- package/assets/web/favicon.svg +1 -0
- package/assets/web/icons.svg +24 -0
- package/assets/web/index.html +15 -0
- package/assets/webui.html +115 -0
- package/client/index.ts +63 -0
- package/config/default_config/app.yaml +64 -0
- package/config/default_config/bilibili.yaml +116 -0
- package/config/default_config/config.json +157 -0
- package/config/default_config/cookies.yaml +11 -0
- package/config/default_config/douyin.yaml +99 -0
- package/config/default_config/kuaishou.yaml +8 -0
- package/config/default_config/pushlist.yaml +37 -0
- package/config/default_config/request.yaml +22 -0
- package/config/default_config/upload.yaml +50 -0
- package/config/default_config/xiaohongshu.yaml +23 -0
- package/dist/index.js +1 -0
- package/lib/compat/axios.js +23 -0
- package/lib/compat/cron.js +77 -0
- package/lib/compat/esm.js +15 -0
- package/lib/compat/express.js +23 -0
- package/lib/compat/heroui.js +12 -0
- package/lib/compat/lodash.js +33 -0
- package/lib/compat/logger.js +118 -0
- package/lib/compat/node-karin.js +1053 -0
- package/lib/compat/phosphor-icons.js +27 -0
- package/lib/compat/qqcard.js +256 -0
- package/lib/compat/root.js +44 -0
- package/lib/compat/runtime.js +87 -0
- package/lib/compat/segment.js +167 -0
- package/lib/compat/sqlite3.js +117 -0
- package/lib/compat/start.js +7 -0
- package/lib/compat/syncConfig.js +65 -0
- package/lib/compat/template-react.js +30 -0
- package/lib/compat/text.js +65 -0
- package/lib/compat/yaml.js +13 -0
- package/lib/configBridge.js +91 -0
- package/lib/index.js +775 -0
- package/lib/karin/app.js +34 -0
- package/lib/karin/apps/__ready.js +9 -0
- package/lib/karin/apps/admin.js +136 -0
- package/lib/karin/apps/help.js +233 -0
- package/lib/karin/apps/push.js +291 -0
- package/lib/karin/apps/qrlogin.js +176 -0
- package/lib/karin/apps/statistics.js +209 -0
- package/lib/karin/apps/testPush.js +247 -0
- package/lib/karin/apps/tools.js +473 -0
- package/lib/karin/apps/update.js +252 -0
- package/lib/karin/index.js +37 -0
- package/lib/karin/module/db/bilibili.js +831 -0
- package/lib/karin/module/db/douyin.js +918 -0
- package/lib/karin/module/db/index.js +165 -0
- package/lib/karin/module/db/migration.js +199 -0
- package/lib/karin/module/db/statistics.js +559 -0
- package/lib/karin/module/index.js +94 -0
- package/lib/karin/module/server/constants/routes.js +48 -0
- package/lib/karin/module/server/controllers/bots.js +230 -0
- package/lib/karin/module/server/controllers/config.js +75 -0
- package/lib/karin/module/server/controllers/video.js +208 -0
- package/lib/karin/module/server/index.js +26 -0
- package/lib/karin/module/server/middlewares/auth.js +133 -0
- package/lib/karin/module/server/routes/amagi.js +57 -0
- package/lib/karin/module/server/routes/api.js +40 -0
- package/lib/karin/module/server/routes/index.js +97 -0
- package/lib/karin/module/server/routes/ssr.js +16 -0
- package/lib/karin/module/server/routes/static.js +43 -0
- package/lib/karin/module/utils/Base.js +403 -0
- package/lib/karin/module/utils/CardParser.js +487 -0
- package/lib/karin/module/utils/Common.js +418 -0
- package/lib/karin/module/utils/Config.js +434 -0
- package/lib/karin/module/utils/EmojiReaction.js +242 -0
- package/lib/karin/module/utils/ErrorHandler/handler.js +114 -0
- package/lib/karin/module/utils/ErrorHandler/index.js +55 -0
- package/lib/karin/module/utils/ErrorHandler/render.js +182 -0
- package/lib/karin/module/utils/ErrorHandler/sender.js +206 -0
- package/lib/karin/module/utils/ErrorHandler/strategy.js +41 -0
- package/lib/karin/module/utils/ErrorHandler/types.js +2 -0
- package/lib/karin/module/utils/ErrorHandler/utils.js +108 -0
- package/lib/karin/module/utils/FFmpeg.js +298 -0
- package/lib/karin/module/utils/ImageHelper.js +91 -0
- package/lib/karin/module/utils/ImageSlice.js +429 -0
- package/lib/karin/module/utils/MotionPhoto.js +250 -0
- package/lib/karin/module/utils/Network/Downloader.js +413 -0
- package/lib/karin/module/utils/Network/ImageDownloader.js +250 -0
- package/lib/karin/module/utils/Network/Network.js +332 -0
- package/lib/karin/module/utils/Network/ThrottleStream.js +71 -0
- package/lib/karin/module/utils/Network/constants.js +129 -0
- package/lib/karin/module/utils/Network/helpers.js +174 -0
- package/lib/karin/module/utils/Network/index.js +34 -0
- package/lib/karin/module/utils/Network/types.js +12 -0
- package/lib/karin/module/utils/Networks.js +17 -0
- package/lib/karin/module/utils/ParseLock.js +34 -0
- package/lib/karin/module/utils/ParseOverride.js +88 -0
- package/lib/karin/module/utils/QqCardResolve.js +114 -0
- package/lib/karin/module/utils/QqPanel.js +879 -0
- package/lib/karin/module/utils/Render/coverTheme.js +256 -0
- package/lib/karin/module/utils/Render/index.js +582 -0
- package/lib/karin/module/utils/amagiClient.js +338 -0
- package/lib/karin/module/utils/avatar.js +201 -0
- package/lib/karin/module/utils/bot.js +141 -0
- package/lib/karin/module/utils/build-metadata.js +50 -0
- package/lib/karin/module/utils/changelog.js +166 -0
- package/lib/karin/module/utils/index.js +26 -0
- package/lib/karin/module/utils/loginSession.js +259 -0
- package/lib/karin/module/utils/parseTip.js +93 -0
- package/lib/karin/module/utils/runtime-report.js +140 -0
- package/lib/karin/module/utils/semver.js +72 -0
- package/lib/karin/module/utils/statisticsAggregate.js +415 -0
- package/lib/karin/platform/bilibili/bilibili.js +1805 -0
- package/lib/karin/platform/bilibili/comments.js +294 -0
- package/lib/karin/platform/bilibili/danmaku.js +555 -0
- package/lib/karin/platform/bilibili/dynamic-text.js +827 -0
- package/lib/karin/platform/bilibili/genParams.js +37 -0
- package/lib/karin/platform/bilibili/getID.js +159 -0
- package/lib/karin/platform/bilibili/index.js +24 -0
- package/lib/karin/platform/bilibili/live-status.js +40 -0
- package/lib/karin/platform/bilibili/login.js +132 -0
- package/lib/karin/platform/bilibili/push.js +1397 -0
- package/lib/karin/platform/bilibili/riskControl.js +133 -0
- package/lib/karin/platform/bilibili/search.js +299 -0
- package/lib/karin/platform/common/danmaku-types.js +12 -0
- package/lib/karin/platform/douyin/comments.js +310 -0
- package/lib/karin/platform/douyin/danmaku.js +893 -0
- package/lib/karin/platform/douyin/douyin.js +1145 -0
- package/lib/karin/platform/douyin/getID.js +94 -0
- package/lib/karin/platform/douyin/index.js +24 -0
- package/lib/karin/platform/douyin/login.js +230 -0
- package/lib/karin/platform/douyin/push/favorite.js +75 -0
- package/lib/karin/platform/douyin/push/index.js +21 -0
- package/lib/karin/platform/douyin/push/live.js +69 -0
- package/lib/karin/platform/douyin/push/post.js +60 -0
- package/lib/karin/platform/douyin/push/recommend.js +74 -0
- package/lib/karin/platform/douyin/push/render.js +621 -0
- package/lib/karin/platform/douyin/push/types.js +2 -0
- package/lib/karin/platform/douyin/push.js +1128 -0
- package/lib/karin/platform/douyin/types.js +13 -0
- package/lib/karin/platform/douyin/videoQuality.js +222 -0
- package/lib/karin/platform/douyin/workType.js +182 -0
- package/lib/karin/platform/index.js +20 -0
- package/lib/karin/platform/kuaishou/comments.js +91 -0
- package/lib/karin/platform/kuaishou/getID.js +43 -0
- package/lib/karin/platform/kuaishou/getdata.js +41 -0
- package/lib/karin/platform/kuaishou/index.js +20 -0
- package/lib/karin/platform/kuaishou/kuaishou.js +122 -0
- package/lib/karin/platform/xiaohongshu/comments.js +162 -0
- package/lib/karin/platform/xiaohongshu/getID.js +129 -0
- package/lib/karin/platform/xiaohongshu/index.js +18 -0
- package/lib/karin/platform/xiaohongshu/xiaohongshu.js +643 -0
- package/lib/karin/root.js +73 -0
- package/lib/karin/setup.js +99 -0
- package/lib/karin/types/config/amagi.js +2 -0
- package/lib/karin/types/config/app.js +2 -0
- package/lib/karin/types/config/bilibili.js +2 -0
- package/lib/karin/types/config/cookies.js +2 -0
- package/lib/karin/types/config/douyin.js +2 -0
- package/lib/karin/types/config/index.js +2 -0
- package/lib/karin/types/config/kuaishou.js +2 -0
- package/lib/karin/types/config/pushlist.js +2 -0
- package/lib/karin/types/config/request.js +2 -0
- package/lib/karin/types/config/upload.js +2 -0
- package/lib/karin/types/config/xiaohongshu.js +2 -0
- package/lib/karin/types/datatypes.js +2 -0
- package/lib/karin/types/index.js +18 -0
- package/lib/karin/types/netrorks/NetworksConfigType.js +2 -0
- package/lib/karin/types/netrorks/index.js +17 -0
- package/lib/karin/web.config.js +49 -0
- package/lib/ktr/registry.js +82 -0
- package/lib/ktr/template/_preview/components/PreviewInfoCard.js +10 -0
- package/lib/ktr/template/_preview/components/PreviewLayout.js +10 -0
- package/lib/ktr/template/_preview/components/PreviewVideoCard.js +8 -0
- package/lib/ktr/template/_preview/render.js +142 -0
- package/lib/ktr/template/_preview/types.js +2 -0
- package/lib/ktr/template/_preview/utils/status.js +31 -0
- package/lib/ktr/template/_preview/utils/time.js +12 -0
- package/lib/ktr/template/bilibili/bangumi/components/bangumi.js +127 -0
- package/lib/ktr/template/bilibili/bangumi/components/types.js +2 -0
- package/lib/ktr/template/bilibili/bangumi/index.js +12 -0
- package/lib/ktr/template/bilibili/comment/components/Comment.js +193 -0
- package/lib/ktr/template/bilibili/comment/components/types.js +2 -0
- package/lib/ktr/template/bilibili/comment/index.js +10 -0
- package/lib/ktr/template/bilibili/components/Icons.js +66 -0
- package/lib/ktr/template/bilibili/components/shared.js +93 -0
- package/lib/ktr/template/bilibili/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/DYNAMIC_TYPE_ARTICLE.js +66 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/DYNAMIC_TYPE_AV.js +87 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/DYNAMIC_TYPE_DRAW.js +93 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/DYNAMIC_TYPE_FORWARD.js +132 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/DYNAMIC_TYPE_LIVE_RCMD.js +84 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/DYNAMIC_TYPE_WORD.js +38 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/components/AdditionalCard.js +59 -0
- package/lib/ktr/template/bilibili/dynamic/components/CommonComponents.js +30 -0
- package/lib/ktr/template/bilibili/dynamic/types.js +2 -0
- package/lib/ktr/template/bilibili/qrcodeImg/components/qrcodeImg.js +48 -0
- package/lib/ktr/template/bilibili/qrcodeImg/components/types.js +3 -0
- package/lib/ktr/template/bilibili/qrcodeImg/index.js +10 -0
- package/lib/ktr/template/bilibili/userlist/components/UserList.js +53 -0
- package/lib/ktr/template/bilibili/userlist/components/types.js +3 -0
- package/lib/ktr/template/bilibili/userlist/index.js +13 -0
- package/lib/ktr/template/bilibili/videoInfo/components/types.js +2 -0
- package/lib/ktr/template/bilibili/videoInfo/components/videoInfo.js +62 -0
- package/lib/ktr/template/bilibili/videoInfo/index.js +10 -0
- package/lib/ktr/template/components/AmbientCover.js +36 -0
- package/lib/ktr/template/components/DefaultLayout.js +33 -0
- package/lib/ktr/template/components/GlowImage.js +276 -0
- package/lib/ktr/template/components/QRCodeWithAvatar.js +34 -0
- package/lib/ktr/template/components/RolldownLogo.js +6 -0
- package/lib/ktr/template/components/ViteLogo.js +6 -0
- package/lib/ktr/template/components/iconRegistry.js +173 -0
- package/lib/ktr/template/douyin/article-work/components/ArticleWork.js +99 -0
- package/lib/ktr/template/douyin/article-work/components/types.js +3 -0
- package/lib/ktr/template/douyin/article-work/index.js +10 -0
- package/lib/ktr/template/douyin/comment/components/Comment.js +189 -0
- package/lib/ktr/template/douyin/comment/components/types.js +2 -0
- package/lib/ktr/template/douyin/comment/index.js +10 -0
- package/lib/ktr/template/douyin/components/Icons.js +29 -0
- package/lib/ktr/template/douyin/components/types.js +3 -0
- package/lib/ktr/template/douyin/dynamic/components/Dynamic.js +90 -0
- package/lib/ktr/template/douyin/dynamic/components/types.js +3 -0
- package/lib/ktr/template/douyin/dynamic/index.js +10 -0
- package/lib/ktr/template/douyin/favorite-list/components/FavoriteList.js +30 -0
- package/lib/ktr/template/douyin/favorite-list/components/types.js +3 -0
- package/lib/ktr/template/douyin/favorite-list/index.js +10 -0
- package/lib/ktr/template/douyin/image-work/components/ImageWork.js +136 -0
- package/lib/ktr/template/douyin/image-work/components/types.js +2 -0
- package/lib/ktr/template/douyin/image-work/index.js +10 -0
- package/lib/ktr/template/douyin/live/components/Live.js +51 -0
- package/lib/ktr/template/douyin/live/components/types.js +3 -0
- package/lib/ktr/template/douyin/live/index.js +10 -0
- package/lib/ktr/template/douyin/musicinfo/components/MusicInfo.js +60 -0
- package/lib/ktr/template/douyin/musicinfo/components/types.js +3 -0
- package/lib/ktr/template/douyin/musicinfo/index.js +10 -0
- package/lib/ktr/template/douyin/qrcodeImg/components/qrcodeImg.js +39 -0
- package/lib/ktr/template/douyin/qrcodeImg/components/types.js +3 -0
- package/lib/ktr/template/douyin/qrcodeImg/index.js +9 -0
- package/lib/ktr/template/douyin/recommend-list/components/RecommendList.js +30 -0
- package/lib/ktr/template/douyin/recommend-list/components/types.js +3 -0
- package/lib/ktr/template/douyin/recommend-list/index.js +10 -0
- package/lib/ktr/template/douyin/user_profile/components/UserVideoList.js +54 -0
- package/lib/ktr/template/douyin/user_profile/components/types.js +3 -0
- package/lib/ktr/template/douyin/user_profile/index.js +9 -0
- package/lib/ktr/template/douyin/userlist/components/UserList.js +50 -0
- package/lib/ktr/template/douyin/userlist/components/types.js +3 -0
- package/lib/ktr/template/douyin/userlist/index.js +13 -0
- package/lib/ktr/template/douyin/video-work/components/VideoWork.js +127 -0
- package/lib/ktr/template/douyin/video-work/components/types.js +2 -0
- package/lib/ktr/template/douyin/video-work/index.js +10 -0
- package/lib/ktr/template/kuaishou/comment/components/Comment.js +88 -0
- package/lib/ktr/template/kuaishou/comment/components/types.js +2 -0
- package/lib/ktr/template/kuaishou/comment/index.js +10 -0
- package/lib/ktr/template/other/changelog/components/changelog.js +117 -0
- package/lib/ktr/template/other/changelog/components/types.js +3 -0
- package/lib/ktr/template/other/changelog/index.js +9 -0
- package/lib/ktr/template/other/handlerError/components/errorTitles.js +227 -0
- package/lib/ktr/template/other/handlerError/components/handlerError.js +392 -0
- package/lib/ktr/template/other/handlerError/components/stackHighlight.js +109 -0
- package/lib/ktr/template/other/handlerError/components/types.js +2 -0
- package/lib/ktr/template/other/handlerError/index.js +9 -0
- package/lib/ktr/template/other/help/components/Help.js +79 -0
- package/lib/ktr/template/other/help/components/types.js +3 -0
- package/lib/ktr/template/other/help/index.js +12 -0
- package/lib/ktr/template/other/live-photo-tip/components/LivePhotoTip.js +80 -0
- package/lib/ktr/template/other/live-photo-tip/components/types.js +3 -0
- package/lib/ktr/template/other/live-photo-tip/index.js +9 -0
- package/lib/ktr/template/other/qrlogin/components/qrlogin.js +58 -0
- package/lib/ktr/template/other/qrlogin/components/types.js +3 -0
- package/lib/ktr/template/other/qrlogin/index.js +9 -0
- package/lib/ktr/template/other/runtime/components/runtime.js +101 -0
- package/lib/ktr/template/other/runtime/components/types.js +3 -0
- package/lib/ktr/template/other/runtime/index.js +9 -0
- package/lib/ktr/template/other/version_warning/components/VersionWarning.js +38 -0
- package/lib/ktr/template/other/version_warning/components/types.js +3 -0
- package/lib/ktr/template/other/version_warning/index.js +9 -0
- package/lib/ktr/template/statistics/components/BoxplotGuide.js +17 -0
- package/lib/ktr/template/statistics/components/ChartCard.js +15 -0
- package/lib/ktr/template/statistics/components/KpiCard.js +14 -0
- package/lib/ktr/template/statistics/components/PlatformTable.js +20 -0
- package/lib/ktr/template/statistics/components/RankList.js +61 -0
- package/lib/ktr/template/statistics/components/SSRChart.js +22 -0
- package/lib/ktr/template/statistics/components/chartPresets.js +630 -0
- package/lib/ktr/template/statistics/components/chartTheme.js +226 -0
- package/lib/ktr/template/statistics/components/format.js +38 -0
- package/lib/ktr/template/statistics/components/types.js +9 -0
- package/lib/ktr/template/statistics/global/components/GlobalStatistics.js +246 -0
- package/lib/ktr/template/statistics/global/components/types.js +3 -0
- package/lib/ktr/template/statistics/global/index.js +9 -0
- package/lib/ktr/template/statistics/group/components/GroupStatistics.js +181 -0
- package/lib/ktr/template/statistics/group/components/types.js +3 -0
- package/lib/ktr/template/statistics/group/index.js +9 -0
- package/lib/ktr/template/types/ctx.js +2 -0
- package/lib/ktr/template/xiaohongshu/comment/components/Comment.js +99 -0
- package/lib/ktr/template/xiaohongshu/comment/components/types.js +3 -0
- package/lib/ktr/template/xiaohongshu/comment/index.js +9 -0
- package/lib/ktr/template/xiaohongshu/noteInfo/components/noteInfo.js +93 -0
- package/lib/ktr/template/xiaohongshu/noteInfo/components/types.js +2 -0
- package/lib/ktr/template/xiaohongshu/noteInfo/index.js +9 -0
- package/lib/ktr/utils/QRCodeAvatar.js +99 -0
- package/lib/ktr/utils/QRcode.js +56 -0
- package/lib/ktr/utils/avatarProxy.js +45 -0
- package/lib/ktr/utils/cn.js +11 -0
- package/lib/ktr/utils/theme.js +12 -0
- package/lib/qqFields.json +75 -0
- package/lib/qqOptions.js +44 -0
- package/lib/richtext/index.js +25 -0
- package/lib/richtext/parse/index.js +232 -0
- package/lib/richtext/react/cn.js +11 -0
- package/lib/richtext/react/index.js +221 -0
- package/lib/richtext/types.js +2 -0
- package/lib/schema.js +352 -0
- package/lib/webui.js +341 -0
- package/package.json +88 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_BV.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_GOODS.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_LOTTERY.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_VIEW_PICTURE.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_VOTE.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_WEB.svg +1 -0
- package/resources/image/bilibili/bilibili-dark.png +0 -0
- package/resources/image/bilibili/bilibili-light.png +0 -0
- package/resources/image/bilibili/bilibili.png +0 -0
- package/resources/image/bilibili/id-dark.svg +1 -0
- package/resources/image/bilibili/id-light.svg +1 -0
- package/resources/image/bilibili/level/lv0.svg +1 -0
- package/resources/image/bilibili/level/lv1.svg +1 -0
- package/resources/image/bilibili/level/lv2.svg +1 -0
- package/resources/image/bilibili/level/lv3.svg +1 -0
- package/resources/image/bilibili/level/lv4.svg +1 -0
- package/resources/image/bilibili/level/lv5.svg +1 -0
- package/resources/image/bilibili/level/lv6.svg +1 -0
- package/resources/image/bilibili/level/lv7.svg +1 -0
- package/resources/image/bilibili/like-dark.svg +6 -0
- package/resources/image/bilibili/like-light.svg +6 -0
- package/resources/image/bilibili/play.svg +28 -0
- package/resources/image/bilibili/res-local1.png +0 -0
- package/resources/image/bilibili/up_pb.svg +1 -0
- package/resources/image/bilibili//347/233/264/346/222/255/344/270/255.png +0 -0
- package/resources/image/douyin/douyin.png +0 -0
- package/resources/image/douyin/dylogo-dark.svg +23 -0
- package/resources/image/douyin/dylogo-light.svg +38 -0
- package/resources/image/douyin/search-dark.svg +1 -0
- package/resources/image/douyin/search-light.svg +3 -0
- package/resources/image/douyin//346/212/226/351/237/263-/347/233/264/346/222/255/344/270/255.png +0 -0
- package/resources/image/frame-logo.png +0 -0
- package/resources/image/kuaishou/logo.png +0 -0
- package/resources/image/other/handlerError/Milky.png +0 -0
- package/resources/image/other/handlerError/chronocat.svg +43 -0
- package/resources/image/other/handlerError/conwechat.webp +0 -0
- package/resources/image/other/handlerError/gocq-http.webp +0 -0
- package/resources/image/other/handlerError/lagrange.webp +0 -0
- package/resources/image/other/handlerError/llonebot.webp +0 -0
- package/resources/image/other/handlerError/napcat.webp +0 -0
- package/resources/image/other/handlerError/onebot.png +0 -0
- package/resources/image/other/handlerError/satori.png +0 -0
- package/resources/image/xiaohongshu/logo.png +0 -0
- package/resources/template/style.css +23708 -0
- package/resources/vite.svg +130 -0
- package/scripts/build.mjs +129 -0
- package/scripts/check-schema.cjs +55 -0
- package/scripts/deploy.mjs +78 -0
- package/scripts/make-demo-placeholders.mjs +112 -0
- package/scripts/patch-deps.mjs +46 -0
- package/scripts/patch-webui.mjs +112 -0
- package/scripts/smoke-commands.cjs +39 -0
- package/scripts/smoke-config.cjs +122 -0
- package/scripts/smoke-douyin.cjs +170 -0
- package/scripts/smoke-koishi-commands.cjs +210 -0
- package/scripts/smoke-login.cjs +110 -0
- package/scripts/smoke-parse.cjs +54 -0
- package/scripts/smoke-push-mock.cjs +114 -0
- package/scripts/smoke-push.cjs +104 -0
- package/scripts/smoke-qq.cjs +147 -0
- package/scripts/smoke-qqcard.cjs +108 -0
- package/scripts/smoke-qqpanel.cjs +205 -0
- package/scripts/smoke-render.cjs +106 -0
- package/scripts/smoke-server.cjs +94 -0
- package/src/compat/axios.ts +5 -0
- package/src/compat/cron.ts +86 -0
- package/src/compat/esm.ts +13 -0
- package/src/compat/express.ts +5 -0
- package/src/compat/heroui.tsx +53 -0
- package/src/compat/lodash.ts +32 -0
- package/src/compat/logger.ts +121 -0
- package/src/compat/node-karin.ts +1064 -0
- package/src/compat/phosphor-icons.tsx +25 -0
- package/src/compat/qqcard.ts +251 -0
- package/src/compat/root.ts +44 -0
- package/src/compat/runtime.ts +120 -0
- package/src/compat/segment.ts +161 -0
- package/src/compat/sqlite3.ts +123 -0
- package/src/compat/start.ts +3 -0
- package/src/compat/syncConfig.ts +64 -0
- package/src/compat/template-react.ts +54 -0
- package/src/compat/text.ts +58 -0
- package/src/compat/yaml.ts +6 -0
- package/src/configBridge.ts +94 -0
- package/src/index.ts +769 -0
- package/src/karin/app.ts +1 -0
- package/src/karin/apps/__ready.ts +14 -0
- package/src/karin/apps/admin.ts +127 -0
- package/src/karin/apps/help.ts +228 -0
- package/src/karin/apps/push.ts +327 -0
- package/src/karin/apps/qrlogin.ts +160 -0
- package/src/karin/apps/statistics.ts +203 -0
- package/src/karin/apps/testPush.ts +226 -0
- package/src/karin/apps/tools.ts +510 -0
- package/src/karin/apps/update.ts +239 -0
- package/src/karin/index.ts +9 -0
- package/src/karin/module/db/bilibili.ts +1089 -0
- package/src/karin/module/db/douyin.ts +1218 -0
- package/src/karin/module/db/index.ts +159 -0
- package/src/karin/module/db/migration.ts +249 -0
- package/src/karin/module/db/statistics.ts +817 -0
- package/src/karin/module/index.ts +37 -0
- package/src/karin/module/server/constants/routes.ts +53 -0
- package/src/karin/module/server/controllers/bots.ts +289 -0
- package/src/karin/module/server/controllers/config.ts +85 -0
- package/src/karin/module/server/controllers/video.ts +212 -0
- package/src/karin/module/server/index.ts +11 -0
- package/src/karin/module/server/middlewares/auth.ts +147 -0
- package/src/karin/module/server/routes/amagi.ts +57 -0
- package/src/karin/module/server/routes/api.ts +42 -0
- package/src/karin/module/server/routes/index.ts +68 -0
- package/src/karin/module/server/routes/ssr.ts +14 -0
- package/src/karin/module/server/routes/static.ts +43 -0
- package/src/karin/module/utils/Base.ts +497 -0
- package/src/karin/module/utils/CardParser.ts +503 -0
- package/src/karin/module/utils/Common.ts +448 -0
- package/src/karin/module/utils/Config.ts +443 -0
- package/src/karin/module/utils/EmojiReaction.ts +268 -0
- package/src/karin/module/utils/ErrorHandler/handler.ts +124 -0
- package/src/karin/module/utils/ErrorHandler/index.ts +48 -0
- package/src/karin/module/utils/ErrorHandler/render.ts +180 -0
- package/src/karin/module/utils/ErrorHandler/sender.ts +192 -0
- package/src/karin/module/utils/ErrorHandler/strategy.ts +41 -0
- package/src/karin/module/utils/ErrorHandler/types.ts +122 -0
- package/src/karin/module/utils/ErrorHandler/utils.ts +108 -0
- package/src/karin/module/utils/FFmpeg.ts +357 -0
- package/src/karin/module/utils/ImageHelper.ts +90 -0
- package/src/karin/module/utils/ImageSlice.ts +383 -0
- package/src/karin/module/utils/MotionPhoto.ts +297 -0
- package/src/karin/module/utils/Network/Downloader.ts +481 -0
- package/src/karin/module/utils/Network/ImageDownloader.ts +291 -0
- package/src/karin/module/utils/Network/Network.ts +344 -0
- package/src/karin/module/utils/Network/ThrottleStream.ts +76 -0
- package/src/karin/module/utils/Network/constants.ts +135 -0
- package/src/karin/module/utils/Network/helpers.ts +183 -0
- package/src/karin/module/utils/Network/index.ts +28 -0
- package/src/karin/module/utils/Network/types.ts +46 -0
- package/src/karin/module/utils/Networks.ts +20 -0
- package/src/karin/module/utils/ParseLock.ts +33 -0
- package/src/karin/module/utils/ParseOverride.ts +128 -0
- package/src/karin/module/utils/QqCardResolve.ts +116 -0
- package/src/karin/module/utils/QqPanel.ts +880 -0
- package/src/karin/module/utils/Render/coverTheme.ts +294 -0
- package/src/karin/module/utils/Render/index.ts +574 -0
- package/src/karin/module/utils/amagiClient.ts +368 -0
- package/src/karin/module/utils/avatar.ts +220 -0
- package/src/karin/module/utils/bot.ts +115 -0
- package/src/karin/module/utils/build-metadata.ts +60 -0
- package/src/karin/module/utils/changelog.ts +175 -0
- package/src/karin/module/utils/index.ts +10 -0
- package/src/karin/module/utils/loginSession.ts +291 -0
- package/src/karin/module/utils/parseTip.ts +59 -0
- package/src/karin/module/utils/runtime-report.ts +142 -0
- package/src/karin/module/utils/semver.ts +60 -0
- package/src/karin/module/utils/statisticsAggregate.ts +507 -0
- package/src/karin/platform/bilibili/bilibili.ts +2004 -0
- package/src/karin/platform/bilibili/comments.ts +397 -0
- package/src/karin/platform/bilibili/danmaku.ts +653 -0
- package/src/karin/platform/bilibili/dynamic-text.ts +926 -0
- package/src/karin/platform/bilibili/genParams.ts +30 -0
- package/src/karin/platform/bilibili/getID.ts +163 -0
- package/src/karin/platform/bilibili/index.ts +8 -0
- package/src/karin/platform/bilibili/live-status.ts +36 -0
- package/src/karin/platform/bilibili/login.ts +130 -0
- package/src/karin/platform/bilibili/push.ts +1615 -0
- package/src/karin/platform/bilibili/riskControl.ts +114 -0
- package/src/karin/platform/bilibili/search.ts +305 -0
- package/src/karin/platform/common/danmaku-types.ts +18 -0
- package/src/karin/platform/douyin/comments.ts +404 -0
- package/src/karin/platform/douyin/danmaku.ts +1187 -0
- package/src/karin/platform/douyin/douyin.ts +1244 -0
- package/src/karin/platform/douyin/getID.ts +101 -0
- package/src/karin/platform/douyin/index.ts +8 -0
- package/src/karin/platform/douyin/login.ts +251 -0
- package/src/karin/platform/douyin/push/favorite.ts +97 -0
- package/src/karin/platform/douyin/push/index.ts +5 -0
- package/src/karin/platform/douyin/push/live.ts +86 -0
- package/src/karin/platform/douyin/push/post.ts +75 -0
- package/src/karin/platform/douyin/push/recommend.ts +96 -0
- package/src/karin/platform/douyin/push/render.ts +768 -0
- package/src/karin/platform/douyin/push/types.ts +41 -0
- package/src/karin/platform/douyin/push.ts +1241 -0
- package/src/karin/platform/douyin/types.ts +151 -0
- package/src/karin/platform/douyin/videoQuality.ts +234 -0
- package/src/karin/platform/douyin/workType.ts +238 -0
- package/src/karin/platform/index.ts +4 -0
- package/src/karin/platform/kuaishou/comments.ts +114 -0
- package/src/karin/platform/kuaishou/getID.ts +48 -0
- package/src/karin/platform/kuaishou/getdata.ts +78 -0
- package/src/karin/platform/kuaishou/index.ts +4 -0
- package/src/karin/platform/kuaishou/kuaishou.ts +130 -0
- package/src/karin/platform/xiaohongshu/comments.ts +227 -0
- package/src/karin/platform/xiaohongshu/getID.ts +127 -0
- package/src/karin/platform/xiaohongshu/index.ts +2 -0
- package/src/karin/platform/xiaohongshu/xiaohongshu.ts +733 -0
- package/src/karin/root.ts +78 -0
- package/src/karin/setup.ts +77 -0
- package/src/karin/types/config/amagi.ts +46 -0
- package/src/karin/types/config/app.ts +129 -0
- package/src/karin/types/config/bilibili.ts +121 -0
- package/src/karin/types/config/cookies.ts +11 -0
- package/src/karin/types/config/douyin.ts +93 -0
- package/src/karin/types/config/index.ts +41 -0
- package/src/karin/types/config/kuaishou.ts +10 -0
- package/src/karin/types/config/pushlist.ts +55 -0
- package/src/karin/types/config/request.ts +27 -0
- package/src/karin/types/config/upload.ts +49 -0
- package/src/karin/types/config/xiaohongshu.ts +24 -0
- package/src/karin/types/datatypes.ts +42 -0
- package/src/karin/types/index.ts +4 -0
- package/src/karin/types/netrorks/NetworksConfigType.ts +61 -0
- package/src/karin/types/netrorks/index.ts +1 -0
- package/src/karin/web.config.ts +48 -0
- package/src/ktr/registry.ts +55 -0
- package/src/ktr/template/_preview/components/PreviewInfoCard.tsx +33 -0
- package/src/ktr/template/_preview/components/PreviewLayout.tsx +65 -0
- package/src/ktr/template/_preview/components/PreviewVideoCard.tsx +22 -0
- package/src/ktr/template/_preview/render.ts +158 -0
- package/src/ktr/template/_preview/types.ts +15 -0
- package/src/ktr/template/_preview/utils/status.ts +29 -0
- package/src/ktr/template/_preview/utils/time.ts +8 -0
- package/src/ktr/template/bilibili/bangumi/components/bangumi.tsx +462 -0
- package/src/ktr/template/bilibili/bangumi/components/types.ts +36 -0
- package/src/ktr/template/bilibili/bangumi/index.tsx +9 -0
- package/src/ktr/template/bilibili/comment/components/Comment.tsx +657 -0
- package/src/ktr/template/bilibili/comment/components/types.ts +26 -0
- package/src/ktr/template/bilibili/comment/index.tsx +11 -0
- package/src/ktr/template/bilibili/components/Icons.tsx +209 -0
- package/src/ktr/template/bilibili/components/shared.tsx +162 -0
- package/src/ktr/template/bilibili/components/types.ts +388 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/DYNAMIC_TYPE_ARTICLE.tsx +251 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/types.ts +67 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/DYNAMIC_TYPE_AV.tsx +238 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/types.ts +39 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/DYNAMIC_TYPE_DRAW.tsx +205 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/types.ts +20 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/index.tsx +11 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/DYNAMIC_TYPE_FORWARD.tsx +348 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/types.ts +16 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/DYNAMIC_TYPE_LIVE_RCMD.tsx +264 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/types.ts +32 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/DYNAMIC_TYPE_WORD.tsx +68 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/types.ts +14 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/components/AdditionalCard.tsx +165 -0
- package/src/ktr/template/bilibili/dynamic/components/CommonComponents.tsx +142 -0
- package/src/ktr/template/bilibili/dynamic/types.ts +382 -0
- package/src/ktr/template/bilibili/qrcodeImg/components/qrcodeImg.tsx +179 -0
- package/src/ktr/template/bilibili/qrcodeImg/components/types.ts +9 -0
- package/src/ktr/template/bilibili/qrcodeImg/index.tsx +12 -0
- package/src/ktr/template/bilibili/userlist/components/UserList.tsx +246 -0
- package/src/ktr/template/bilibili/userlist/components/types.ts +35 -0
- package/src/ktr/template/bilibili/userlist/index.tsx +11 -0
- package/src/ktr/template/bilibili/videoInfo/components/types.ts +28 -0
- package/src/ktr/template/bilibili/videoInfo/components/videoInfo.tsx +217 -0
- package/src/ktr/template/bilibili/videoInfo/index.tsx +12 -0
- package/src/ktr/template/components/AmbientCover.tsx +50 -0
- package/src/ktr/template/components/DefaultLayout.tsx +166 -0
- package/src/ktr/template/components/GlowImage.tsx +572 -0
- package/src/ktr/template/components/QRCodeWithAvatar.tsx +52 -0
- package/src/ktr/template/components/RolldownLogo.tsx +110 -0
- package/src/ktr/template/components/ViteLogo.tsx +134 -0
- package/src/ktr/template/components/iconRegistry.ts +294 -0
- package/src/ktr/template/douyin/article-work/components/ArticleWork.tsx +301 -0
- package/src/ktr/template/douyin/article-work/components/types.ts +53 -0
- package/src/ktr/template/douyin/article-work/index.tsx +12 -0
- package/src/ktr/template/douyin/comment/components/Comment.tsx +612 -0
- package/src/ktr/template/douyin/comment/components/types.ts +85 -0
- package/src/ktr/template/douyin/comment/index.tsx +11 -0
- package/src/ktr/template/douyin/components/Icons.tsx +75 -0
- package/src/ktr/template/douyin/components/types.ts +83 -0
- package/src/ktr/template/douyin/dynamic/components/Dynamic.tsx +283 -0
- package/src/ktr/template/douyin/dynamic/components/types.ts +46 -0
- package/src/ktr/template/douyin/dynamic/index.tsx +11 -0
- package/src/ktr/template/douyin/favorite-list/components/FavoriteList.tsx +201 -0
- package/src/ktr/template/douyin/favorite-list/components/types.ts +38 -0
- package/src/ktr/template/douyin/favorite-list/index.tsx +12 -0
- package/src/ktr/template/douyin/image-work/components/ImageWork.tsx +437 -0
- package/src/ktr/template/douyin/image-work/components/types.ts +78 -0
- package/src/ktr/template/douyin/image-work/index.tsx +11 -0
- package/src/ktr/template/douyin/live/components/Live.tsx +229 -0
- package/src/ktr/template/douyin/live/components/types.ts +47 -0
- package/src/ktr/template/douyin/live/index.tsx +11 -0
- package/src/ktr/template/douyin/musicinfo/components/MusicInfo.tsx +187 -0
- package/src/ktr/template/douyin/musicinfo/components/types.ts +31 -0
- package/src/ktr/template/douyin/musicinfo/index.tsx +11 -0
- package/src/ktr/template/douyin/qrcodeImg/components/qrcodeImg.tsx +170 -0
- package/src/ktr/template/douyin/qrcodeImg/components/types.ts +9 -0
- package/src/ktr/template/douyin/qrcodeImg/index.tsx +9 -0
- package/src/ktr/template/douyin/recommend-list/components/RecommendList.tsx +201 -0
- package/src/ktr/template/douyin/recommend-list/components/types.ts +37 -0
- package/src/ktr/template/douyin/recommend-list/index.tsx +12 -0
- package/src/ktr/template/douyin/user_profile/components/UserVideoList.tsx +225 -0
- package/src/ktr/template/douyin/user_profile/components/types.ts +71 -0
- package/src/ktr/template/douyin/user_profile/index.tsx +9 -0
- package/src/ktr/template/douyin/userlist/components/UserList.tsx +229 -0
- package/src/ktr/template/douyin/userlist/components/types.ts +35 -0
- package/src/ktr/template/douyin/userlist/index.tsx +11 -0
- package/src/ktr/template/douyin/video-work/components/VideoWork.tsx +398 -0
- package/src/ktr/template/douyin/video-work/components/types.ts +80 -0
- package/src/ktr/template/douyin/video-work/index.tsx +11 -0
- package/src/ktr/template/font.css +6071 -0
- package/src/ktr/template/global.d.ts +69 -0
- package/src/ktr/template/kuaishou/comment/components/Comment.tsx +207 -0
- package/src/ktr/template/kuaishou/comment/components/types.ts +47 -0
- package/src/ktr/template/kuaishou/comment/index.tsx +11 -0
- package/src/ktr/template/other/changelog/components/changelog.tsx +411 -0
- package/src/ktr/template/other/changelog/components/types.ts +21 -0
- package/src/ktr/template/other/changelog/index.tsx +9 -0
- package/src/ktr/template/other/handlerError/components/errorTitles.ts +224 -0
- package/src/ktr/template/other/handlerError/components/handlerError.tsx +1076 -0
- package/src/ktr/template/other/handlerError/components/stackHighlight.ts +127 -0
- package/src/ktr/template/other/handlerError/components/types.ts +124 -0
- package/src/ktr/template/other/handlerError/index.tsx +9 -0
- package/src/ktr/template/other/help/components/Help.tsx +249 -0
- package/src/ktr/template/other/help/components/types.ts +47 -0
- package/src/ktr/template/other/help/index.tsx +9 -0
- package/src/ktr/template/other/live-photo-tip/components/LivePhotoTip.tsx +295 -0
- package/src/ktr/template/other/live-photo-tip/components/types.ts +8 -0
- package/src/ktr/template/other/live-photo-tip/index.tsx +9 -0
- package/src/ktr/template/other/qrlogin/components/qrlogin.tsx +295 -0
- package/src/ktr/template/other/qrlogin/components/types.ts +11 -0
- package/src/ktr/template/other/qrlogin/index.tsx +9 -0
- package/src/ktr/template/other/runtime/components/runtime.tsx +347 -0
- package/src/ktr/template/other/runtime/components/types.ts +75 -0
- package/src/ktr/template/other/runtime/index.tsx +9 -0
- package/src/ktr/template/other/version_warning/components/VersionWarning.tsx +392 -0
- package/src/ktr/template/other/version_warning/components/types.ts +8 -0
- package/src/ktr/template/other/version_warning/index.tsx +9 -0
- package/src/ktr/template/statistics/components/BoxplotGuide.tsx +57 -0
- package/src/ktr/template/statistics/components/ChartCard.tsx +40 -0
- package/src/ktr/template/statistics/components/KpiCard.tsx +39 -0
- package/src/ktr/template/statistics/components/PlatformTable.tsx +83 -0
- package/src/ktr/template/statistics/components/RankList.tsx +127 -0
- package/src/ktr/template/statistics/components/SSRChart.tsx +41 -0
- package/src/ktr/template/statistics/components/chartPresets.ts +700 -0
- package/src/ktr/template/statistics/components/chartTheme.ts +234 -0
- package/src/ktr/template/statistics/components/format.ts +33 -0
- package/src/ktr/template/statistics/components/types.ts +92 -0
- package/src/ktr/template/statistics/global/components/GlobalStatistics.tsx +597 -0
- package/src/ktr/template/statistics/global/components/types.ts +138 -0
- package/src/ktr/template/statistics/global/index.tsx +9 -0
- package/src/ktr/template/statistics/group/components/GroupStatistics.tsx +468 -0
- package/src/ktr/template/statistics/group/components/types.ts +113 -0
- package/src/ktr/template/statistics/group/index.tsx +9 -0
- package/src/ktr/template/style.css +65 -0
- package/src/ktr/template/types/ctx.ts +42 -0
- package/src/ktr/template/xiaohongshu/comment/components/Comment.tsx +264 -0
- package/src/ktr/template/xiaohongshu/comment/components/types.ts +119 -0
- package/src/ktr/template/xiaohongshu/comment/index.tsx +9 -0
- package/src/ktr/template/xiaohongshu/noteInfo/components/noteInfo.tsx +271 -0
- package/src/ktr/template/xiaohongshu/noteInfo/components/types.ts +66 -0
- package/src/ktr/template/xiaohongshu/noteInfo/index.tsx +9 -0
- package/src/ktr/utils/QRCodeAvatar.ts +102 -0
- package/src/ktr/utils/QRcode.ts +65 -0
- package/src/ktr/utils/avatarProxy.ts +42 -0
- package/src/ktr/utils/cn.ts +6 -0
- package/src/ktr/utils/theme.ts +10 -0
- package/src/qqFields.json +75 -0
- package/src/qqOptions.ts +64 -0
- package/src/richtext/index.ts +9 -0
- package/src/richtext/parse/index.ts +271 -0
- package/src/richtext/react/cn.ts +6 -0
- package/src/richtext/react/index.tsx +582 -0
- package/src/richtext/types.ts +320 -0
- package/src/schema.ts +372 -0
- package/src/webui.ts +352 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDouyinWorkDetail = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 把 amagi 返回的 aweme 对象装配成渲染/推送使用的作品详情。
|
|
6
|
+
* amagi 的生成类型在 text_extra(实为对象数组)、images(图文作品实为数组)等字段上
|
|
7
|
+
* 与真实数据不符,统一在这一处边界断言,下游全部享受精确类型。
|
|
8
|
+
* 返回类型会带上 extra 的实际形状,例如传入 user_info 后下游可把它当作必填字段使用。
|
|
9
|
+
* @param aweme - amagi 返回的作品详情(aweme_detail 或作品列表项)
|
|
10
|
+
* @param extra - 流程附加字段(作者/订阅者主页信息)
|
|
11
|
+
*/
|
|
12
|
+
const buildDouyinWorkDetail = (aweme, extra = {}) => ({ ...aweme, ...extra });
|
|
13
|
+
exports.buildDouyinWorkDetail = buildDouyinWorkDetail;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.douyinProcessVideos = exports.formatDouyinQualityLabel = exports.buildDouyinPlayUrl = exports.getDouyinQualityLevel = void 0;
|
|
4
|
+
const node_karin_1 = require("../../../compat/node-karin.js");
|
|
5
|
+
const Config_1 = require("../../module/utils/Config");
|
|
6
|
+
/** 档位优先级,从高到低 */
|
|
7
|
+
const QUALITY_PRIORITY = ['4k', '2k', '1080p', '720p', '540p'];
|
|
8
|
+
/**
|
|
9
|
+
* `video_extra.definition` → 内部档位名。
|
|
10
|
+
* 抖音上游把 2K 记作 `1440p`,而配置项 `videoQuality` 用的是 `2k`,
|
|
11
|
+
* 这张表是两套词表唯一的翻译点,配置域不需要跟着上游改。
|
|
12
|
+
*/
|
|
13
|
+
const DEFINITION_TO_LEVEL = {
|
|
14
|
+
'4k': '4k',
|
|
15
|
+
'2k': '2k',
|
|
16
|
+
'1440p': '2k',
|
|
17
|
+
'1080p': '1080p',
|
|
18
|
+
'720p': '720p',
|
|
19
|
+
'540p': '540p'
|
|
20
|
+
};
|
|
21
|
+
/** 档位 → 展示标签,沿用抖音 Web 端播放器的说法 */
|
|
22
|
+
const QUALITY_LABEL = {
|
|
23
|
+
'4k': '超清4K',
|
|
24
|
+
'2k': '超清2K',
|
|
25
|
+
'1080p': '高清1080P',
|
|
26
|
+
'720p': '高清720P',
|
|
27
|
+
'540p': '标清540P'
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 安全解析 `video_extra`
|
|
31
|
+
* @param extra - 原始 JSON 字符串
|
|
32
|
+
* @returns 解析结果,为空或非法 JSON 时返回 null
|
|
33
|
+
*/
|
|
34
|
+
const parseVideoExtra = (extra) => {
|
|
35
|
+
if (!extra)
|
|
36
|
+
return null;
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(extra);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* 从 `gear_name` 猜测档位。
|
|
46
|
+
* 只作为 `video_extra.definition` 缺失时的兜底:抖音随时可能新增 gear_name,
|
|
47
|
+
* 认不出来就返回 undefined 交给调用方处理,不再默认落到 540p 污染分档。
|
|
48
|
+
* @param gearName - 视频源的 gear_name
|
|
49
|
+
* @returns 档位名,认不出时返回 undefined
|
|
50
|
+
*/
|
|
51
|
+
const guessLevelFromGearName = (gearName) => {
|
|
52
|
+
if (gearName.includes('lowest_4') || gearName.includes('2160'))
|
|
53
|
+
return '4k';
|
|
54
|
+
if (gearName.includes('1440') || gearName.includes('2k'))
|
|
55
|
+
return '2k';
|
|
56
|
+
if (gearName.includes('1080'))
|
|
57
|
+
return '1080p';
|
|
58
|
+
if (gearName.includes('720'))
|
|
59
|
+
return '720p';
|
|
60
|
+
if (gearName.includes('540'))
|
|
61
|
+
return '540p';
|
|
62
|
+
return undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 判定单个视频源的清晰度档位。
|
|
66
|
+
* `video_extra.definition` 是唯一可信来源:抖音视频比例不固定(存在 21:9、1:1 等),
|
|
67
|
+
* 一个 3840x1608 的视频不满足 3840x2160 但官方仍定义为 4K,所以不能拿 play_addr 的宽高硬匹配。
|
|
68
|
+
* @param video - 视频源对象
|
|
69
|
+
* @returns 档位名,无法判定时返回 undefined
|
|
70
|
+
*/
|
|
71
|
+
const getDouyinQualityLevel = (video) => {
|
|
72
|
+
const definition = parseVideoExtra(video.video_extra)?.definition;
|
|
73
|
+
const level = definition ? DEFINITION_TO_LEVEL[definition] : undefined;
|
|
74
|
+
return level ?? guessLevelFromGearName(video.gear_name ?? '');
|
|
75
|
+
};
|
|
76
|
+
exports.getDouyinQualityLevel = getDouyinQualityLevel;
|
|
77
|
+
/**
|
|
78
|
+
* 同档位内的取源顺序:先 H.264,再按体积从大到小。
|
|
79
|
+
* 1080p / 720p 的 H.265(ByteVC1)在部分协议端软解失败,同档位下 H.264 更稳;
|
|
80
|
+
* 4K / 2K 上游通常只提供 H.265,此时全组同权重,自然退化为按体积排序。
|
|
81
|
+
* @param a - 视频源 A
|
|
82
|
+
* @param b - 视频源 B
|
|
83
|
+
* @returns 排序比较值
|
|
84
|
+
*/
|
|
85
|
+
const compareVideoPreference = (a, b) => {
|
|
86
|
+
if (a.is_bytevc1 !== b.is_bytevc1)
|
|
87
|
+
return a.is_bytevc1 - b.is_bytevc1;
|
|
88
|
+
return b.play_addr.data_size - a.play_addr.data_size;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* 按档位给 mp4 视频源分组,组内已按 {@link compareVideoPreference} 排好序
|
|
92
|
+
* @param videos - 视频源数组
|
|
93
|
+
* @returns 档位 → 该档位下的视频源
|
|
94
|
+
*/
|
|
95
|
+
const groupByQualityLevel = (videos) => {
|
|
96
|
+
const grouped = new Map();
|
|
97
|
+
for (const video of videos) {
|
|
98
|
+
const level = (0, exports.getDouyinQualityLevel)(video);
|
|
99
|
+
if (!level) {
|
|
100
|
+
node_karin_1.logger.debug(`无法判定清晰度档位,跳过该视频源:gear_name=${video.gear_name}`);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const bucket = grouped.get(level);
|
|
104
|
+
if (bucket) {
|
|
105
|
+
bucket.push(video);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
grouped.set(level, [video]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
grouped.forEach((bucket) => bucket.sort(compareVideoPreference));
|
|
112
|
+
return grouped;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* 构建抖音视频播放地址(二维码分享链接与下载共用)。
|
|
116
|
+
* 上游 play 接口现在除 video_id 外还要求携带 file_id(从 play_addr.url_list[2] 的查询参数中提取),
|
|
117
|
+
* 旧的 ratio/line 参数不再需要;file_id 提取失败时回退为仅带 video_id。
|
|
118
|
+
* @param playAddr - 视频源的 play_addr 对象(bit_rate 项或 images 项的 play_addr_h264)
|
|
119
|
+
* @returns 完整的播放地址
|
|
120
|
+
*/
|
|
121
|
+
const buildDouyinPlayUrl = (playAddr) => {
|
|
122
|
+
const fileId = (() => {
|
|
123
|
+
try {
|
|
124
|
+
const wrappedUrl = playAddr.url_list?.[2];
|
|
125
|
+
return wrappedUrl ? new URL(wrappedUrl).searchParams.get('file_id') : null;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
})();
|
|
131
|
+
return fileId
|
|
132
|
+
? `https://aweme.snssdk.com/aweme/v1/play/?video_id=${playAddr.uri}&file_id=${fileId}`
|
|
133
|
+
: `https://aweme.snssdk.com/aweme/v1/play/?video_id=${playAddr.uri}`;
|
|
134
|
+
};
|
|
135
|
+
exports.buildDouyinPlayUrl = buildDouyinPlayUrl;
|
|
136
|
+
/**
|
|
137
|
+
* 把选中的视频源格式化成展示用的清晰度字符串。
|
|
138
|
+
* 传入的必须是 {@link douyinProcessVideos} 选中的那一路源 —— 卡片上展示的清晰度要和实际下载的一致,
|
|
139
|
+
* 否则会出现「卡片写 4K、实际下载 720p」的错位。
|
|
140
|
+
* @param video - 选中的视频源
|
|
141
|
+
* @returns 形如 `超清4K`;档位认不出时返回空字符串
|
|
142
|
+
*/
|
|
143
|
+
const formatDouyinQualityLabel = (video) => {
|
|
144
|
+
if (!video)
|
|
145
|
+
return '';
|
|
146
|
+
const level = (0, exports.getDouyinQualityLevel)(video);
|
|
147
|
+
if (!level)
|
|
148
|
+
return '';
|
|
149
|
+
return QUALITY_LABEL[level];
|
|
150
|
+
};
|
|
151
|
+
exports.formatDouyinQualityLabel = formatDouyinQualityLabel;
|
|
152
|
+
/**
|
|
153
|
+
* 按画质偏好从抖音视频源列表里挑出唯一一路可下载的源
|
|
154
|
+
* @param videos - `aweme_detail.video.bit_rate` 数组
|
|
155
|
+
* @param videoQuality - 画质偏好,`adapt` 为按体积上限自动选择,其余为固定档位
|
|
156
|
+
* @param maxAutoVideoSize - 自动模式下可接受的最大体积(MB),缺省回落到 `Config.app.filelimit`
|
|
157
|
+
* @returns 长度为 1 的数组,元素为选中的视频源
|
|
158
|
+
*/
|
|
159
|
+
const douyinProcessVideos = (videos, videoQuality, maxAutoVideoSize) => {
|
|
160
|
+
// Web 端与下载都只认 mp4 封装,dash 是 App 端流媒体专用
|
|
161
|
+
const mp4Videos = videos.filter((video) => video.format === 'mp4');
|
|
162
|
+
if (mp4Videos.length === 0) {
|
|
163
|
+
node_karin_1.logger.warn('没有找到可用的 mp4 格式视频');
|
|
164
|
+
return videos.slice(0, 1); // 返回第一个视频作为备选
|
|
165
|
+
}
|
|
166
|
+
node_karin_1.logger.debug(`过滤后剩余 ${mp4Videos.length} 个 mp4 格式视频`);
|
|
167
|
+
const videosByQuality = groupByQualityLevel(mp4Videos);
|
|
168
|
+
// 如果是自动模式
|
|
169
|
+
if (videoQuality === 'adapt') {
|
|
170
|
+
const sizeLimitBytes = (maxAutoVideoSize || Config_1.Config.app.filelimit) * 1024 * 1024;
|
|
171
|
+
for (const quality of QUALITY_PRIORITY) {
|
|
172
|
+
const qualityVideos = videosByQuality.get(quality);
|
|
173
|
+
if (qualityVideos && qualityVideos.length > 0) {
|
|
174
|
+
// 该档位下第一个不超过体积上限的源(组内已按 H.264 优先、体积从大到小排序)
|
|
175
|
+
const suitableVideo = qualityVideos.find((video) => video.play_addr.data_size <= sizeLimitBytes);
|
|
176
|
+
if (suitableVideo) {
|
|
177
|
+
node_karin_1.logger.debug(`自动选择画质: ${quality}, 文件大小: ${(suitableVideo.play_addr.data_size / (1024 * 1024)).toFixed(2)}MB`);
|
|
178
|
+
return [suitableVideo];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// 如果没有找到符合大小限制的视频,选择最小的视频
|
|
183
|
+
let smallestVideo = mp4Videos[0];
|
|
184
|
+
mp4Videos.forEach((video) => {
|
|
185
|
+
if (video.play_addr.data_size < smallestVideo.play_addr.data_size) {
|
|
186
|
+
smallestVideo = video;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
node_karin_1.logger.debug(`未找到符合大小限制的视频,选择最小视频: ${(smallestVideo.play_addr.data_size / (1024 * 1024)).toFixed(2)}MB`);
|
|
190
|
+
return [smallestVideo];
|
|
191
|
+
}
|
|
192
|
+
// 固定画质模式
|
|
193
|
+
const targetQuality = videoQuality;
|
|
194
|
+
const targetVideos = videosByQuality.get(targetQuality);
|
|
195
|
+
if (targetVideos && targetVideos.length > 0) {
|
|
196
|
+
// 选择该画质下最优的视频源
|
|
197
|
+
node_karin_1.logger.debug(`选择固定画质: ${targetQuality}, 文件大小: ${(targetVideos[0].play_addr.data_size / (1024 * 1024)).toFixed(2)}MB`);
|
|
198
|
+
return [targetVideos[0]];
|
|
199
|
+
}
|
|
200
|
+
// 如果没有找到目标画质,选择最接近的画质
|
|
201
|
+
const targetIndex = QUALITY_PRIORITY.indexOf(targetQuality);
|
|
202
|
+
// 先尝试向下找(更低画质)
|
|
203
|
+
for (let i = targetIndex + 1; i < QUALITY_PRIORITY.length; i++) {
|
|
204
|
+
const fallbackVideos = videosByQuality.get(QUALITY_PRIORITY[i]);
|
|
205
|
+
if (fallbackVideos && fallbackVideos.length > 0) {
|
|
206
|
+
node_karin_1.logger.debug(`目标画质 ${targetQuality} 不可用,降级到: ${QUALITY_PRIORITY[i]}`);
|
|
207
|
+
return [fallbackVideos[0]];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// 再尝试向上找(更高画质)
|
|
211
|
+
for (let i = targetIndex - 1; i >= 0; i--) {
|
|
212
|
+
const fallbackVideos = videosByQuality.get(QUALITY_PRIORITY[i]);
|
|
213
|
+
if (fallbackVideos && fallbackVideos.length > 0) {
|
|
214
|
+
node_karin_1.logger.debug(`目标画质 ${targetQuality} 不可用,升级到: ${QUALITY_PRIORITY[i]}`);
|
|
215
|
+
return [fallbackVideos[0]];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// 如果都没找到,返回第一个可用视频
|
|
219
|
+
node_karin_1.logger.warn('未找到任何匹配的画质,返回默认视频');
|
|
220
|
+
return [mp4Videos[0]];
|
|
221
|
+
};
|
|
222
|
+
exports.douyinProcessVideos = douyinProcessVideos;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DouyinImageSubType = exports.DouyinWorkMainType = void 0;
|
|
4
|
+
exports.getWorkTypeFromUrl = getWorkTypeFromUrl;
|
|
5
|
+
exports.getWorkTypeInfo = getWorkTypeInfo;
|
|
6
|
+
exports.getWorkCoverUrl = getWorkCoverUrl;
|
|
7
|
+
exports.getWorkTypeDisplayName = getWorkTypeDisplayName;
|
|
8
|
+
exports.needsSpecialImageProcessing = needsSpecialImageProcessing;
|
|
9
|
+
exports.getDouyinLiveImageSendPolicy = getDouyinLiveImageSendPolicy;
|
|
10
|
+
/**
|
|
11
|
+
* 抖音作品类型工具模块
|
|
12
|
+
* 提供统一的作品类型判断和处理逻辑
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* 抖音作品主类型
|
|
16
|
+
*/
|
|
17
|
+
var DouyinWorkMainType;
|
|
18
|
+
(function (DouyinWorkMainType) {
|
|
19
|
+
/** 视频作品 */
|
|
20
|
+
DouyinWorkMainType["VIDEO"] = "video";
|
|
21
|
+
/** 图文作品(包含图集和合辑) */
|
|
22
|
+
DouyinWorkMainType["IMAGE"] = "image";
|
|
23
|
+
/** 文章作品 */
|
|
24
|
+
DouyinWorkMainType["ARTICLE"] = "article";
|
|
25
|
+
/** 直播 */
|
|
26
|
+
DouyinWorkMainType["LIVE"] = "live";
|
|
27
|
+
/** 音乐 */
|
|
28
|
+
DouyinWorkMainType["MUSIC"] = "music";
|
|
29
|
+
/** 未知类型 */
|
|
30
|
+
DouyinWorkMainType["UNKNOWN"] = "unknown";
|
|
31
|
+
})(DouyinWorkMainType || (exports.DouyinWorkMainType = DouyinWorkMainType = {}));
|
|
32
|
+
/**
|
|
33
|
+
* 图文作品子类型
|
|
34
|
+
*/
|
|
35
|
+
var DouyinImageSubType;
|
|
36
|
+
(function (DouyinImageSubType) {
|
|
37
|
+
/** 图集(纯静态图片或包含 live 图) */
|
|
38
|
+
DouyinImageSubType["GALLERY"] = "gallery";
|
|
39
|
+
/** 合辑(图片+视频混合) */
|
|
40
|
+
DouyinImageSubType["COLLECTION"] = "collection";
|
|
41
|
+
})(DouyinImageSubType || (exports.DouyinImageSubType = DouyinImageSubType = {}));
|
|
42
|
+
/**
|
|
43
|
+
* 从 URL 路径判断作品类型
|
|
44
|
+
*/
|
|
45
|
+
function getWorkTypeFromUrl(url) {
|
|
46
|
+
if (/\/video\//.test(url))
|
|
47
|
+
return DouyinWorkMainType.VIDEO;
|
|
48
|
+
if (/\/note\//.test(url))
|
|
49
|
+
return DouyinWorkMainType.IMAGE;
|
|
50
|
+
if (/\/article\//.test(url))
|
|
51
|
+
return DouyinWorkMainType.ARTICLE;
|
|
52
|
+
if (/live\.douyin\.com/.test(url) || /webcast\.amemv\.com/.test(url))
|
|
53
|
+
return DouyinWorkMainType.LIVE;
|
|
54
|
+
if (/\/music\//.test(url))
|
|
55
|
+
return DouyinWorkMainType.MUSIC;
|
|
56
|
+
return DouyinWorkMainType.UNKNOWN;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 从作品数据判断详细类型信息
|
|
60
|
+
*/
|
|
61
|
+
function getWorkTypeInfo(data) {
|
|
62
|
+
// 直播类型(有 live_data 对象)
|
|
63
|
+
if (data.live_data) {
|
|
64
|
+
return {
|
|
65
|
+
mainType: DouyinWorkMainType.LIVE,
|
|
66
|
+
isVideo: false,
|
|
67
|
+
isImage: false,
|
|
68
|
+
isArticle: false,
|
|
69
|
+
isLive: true,
|
|
70
|
+
isGallery: false,
|
|
71
|
+
isCollection: false,
|
|
72
|
+
templatePath: 'douyin/live'
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// 文章类型(aweme_type === 163)
|
|
76
|
+
if (data.aweme_type === 163 || data.article_info) {
|
|
77
|
+
return {
|
|
78
|
+
mainType: DouyinWorkMainType.ARTICLE,
|
|
79
|
+
isVideo: false,
|
|
80
|
+
isImage: false,
|
|
81
|
+
isArticle: true,
|
|
82
|
+
isLive: false,
|
|
83
|
+
isGallery: false,
|
|
84
|
+
isCollection: false,
|
|
85
|
+
templatePath: 'douyin/article-work'
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// 图文类型(有 images 数组)
|
|
89
|
+
if (data.images && data.images.length > 0) {
|
|
90
|
+
const subType = data.is_slides === true ? DouyinImageSubType.COLLECTION : DouyinImageSubType.GALLERY;
|
|
91
|
+
return {
|
|
92
|
+
mainType: DouyinWorkMainType.IMAGE,
|
|
93
|
+
subType,
|
|
94
|
+
isVideo: false,
|
|
95
|
+
isImage: true,
|
|
96
|
+
isArticle: false,
|
|
97
|
+
isLive: false,
|
|
98
|
+
isGallery: subType === DouyinImageSubType.GALLERY,
|
|
99
|
+
isCollection: subType === DouyinImageSubType.COLLECTION,
|
|
100
|
+
templatePath: 'douyin/image-work'
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// 视频类型(默认)
|
|
104
|
+
return {
|
|
105
|
+
mainType: DouyinWorkMainType.VIDEO,
|
|
106
|
+
isVideo: true,
|
|
107
|
+
isImage: false,
|
|
108
|
+
isArticle: false,
|
|
109
|
+
isLive: false,
|
|
110
|
+
isGallery: false,
|
|
111
|
+
isCollection: false,
|
|
112
|
+
templatePath: 'douyin/video-work'
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** 抖音图床低分辨率处理模板(如 ~tplv-dy-360p.jpeg),命中说明该封面 URL 被 CDN 降质 */
|
|
116
|
+
const LOW_RES_COVER_PATTERN = /~tplv-[^/?]*(?:270p|360p|480p|540p)/i;
|
|
117
|
+
/**
|
|
118
|
+
* 获取作品封面 URL
|
|
119
|
+
*/
|
|
120
|
+
function getWorkCoverUrl(workTypeInfo, data) {
|
|
121
|
+
// 视频封面
|
|
122
|
+
if (workTypeInfo.isVideo && data.video) {
|
|
123
|
+
// 详情接口没有 animated_cover,会落到 cover_original_scale,
|
|
124
|
+
// 而它的 url_list[0] 常是 ~tplv-dy-360p 这类 CDN 降质模板(签名绑定路径,无法改 URL 还原)。
|
|
125
|
+
// 所以按优先级收集所有候选后,优先取未命中低清模板的;全部命中时维持原优先级兜底。
|
|
126
|
+
const candidates = [data.video.animated_cover, data.video.cover_original_scale, data.video.origin_cover, data.video.cover].flatMap((field) => field?.url_list ?? []);
|
|
127
|
+
return candidates.find((url) => !LOW_RES_COVER_PATTERN.test(url)) ?? candidates[0] ?? '';
|
|
128
|
+
}
|
|
129
|
+
// 图文封面
|
|
130
|
+
if (workTypeInfo.isImage && data.images && data.images.length > 0) {
|
|
131
|
+
return data.images[0].url_list[0] ?? '';
|
|
132
|
+
}
|
|
133
|
+
// 文章封面
|
|
134
|
+
if (workTypeInfo.isArticle && data.article_info?.article_content) {
|
|
135
|
+
try {
|
|
136
|
+
const content = JSON.parse(data.article_info.article_content);
|
|
137
|
+
return content.head_poster_list?.url_list?.[0] ?? '';
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return '';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 获取作品类型的显示名称
|
|
147
|
+
*/
|
|
148
|
+
function getWorkTypeDisplayName(workTypeInfo) {
|
|
149
|
+
if (workTypeInfo.isVideo)
|
|
150
|
+
return '视频';
|
|
151
|
+
if (workTypeInfo.isGallery)
|
|
152
|
+
return '图集';
|
|
153
|
+
if (workTypeInfo.isCollection)
|
|
154
|
+
return '合辑';
|
|
155
|
+
if (workTypeInfo.isArticle)
|
|
156
|
+
return '文章';
|
|
157
|
+
if (workTypeInfo.isLive)
|
|
158
|
+
return '直播';
|
|
159
|
+
return '未知';
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 判断是否需要特殊处理(如 live 图)
|
|
163
|
+
*/
|
|
164
|
+
function needsSpecialImageProcessing(workTypeInfo, images) {
|
|
165
|
+
if (!workTypeInfo.isImage || !images)
|
|
166
|
+
return false;
|
|
167
|
+
// 检查是否包含 live 图(clip_type !== 2)
|
|
168
|
+
return images.some((item) => item.clip_type !== 2 && item.clip_type !== undefined);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 抖音图文里的 clip_type=5 才能生成系统实况图;clip_type=4 是短片。
|
|
172
|
+
* 用户选择仅发送实况图时,短片仍需兜底成视频节点,避免生成空合并转发。
|
|
173
|
+
*/
|
|
174
|
+
function getDouyinLiveImageSendPolicy(clipType, livePhotoMode = 'video_and_livephoto') {
|
|
175
|
+
const isStaticImage = clipType === 2 || clipType === undefined;
|
|
176
|
+
const canGenerateLivePhoto = clipType === 5;
|
|
177
|
+
const shouldFallbackToVideo = livePhotoMode === 'livephoto_only' && !isStaticImage && !canGenerateLivePhoto;
|
|
178
|
+
return {
|
|
179
|
+
shouldGenerateVideo: livePhotoMode === 'video_and_livephoto' || livePhotoMode === 'video_only' || shouldFallbackToVideo,
|
|
180
|
+
shouldGenerateLivePhoto: canGenerateLivePhoto && (livePhotoMode === 'video_and_livephoto' || livePhotoMode === 'livephoto_only')
|
|
181
|
+
};
|
|
182
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bilibili"), exports);
|
|
18
|
+
__exportStar(require("./douyin"), exports);
|
|
19
|
+
__exportStar(require("./kuaishou"), exports);
|
|
20
|
+
__exportStar(require("./xiaohongshu"), exports);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kuaishouComments = void 0;
|
|
4
|
+
const richtext_1 = require("../../../richtext");
|
|
5
|
+
const Config_1 = require("../../module/utils/Config");
|
|
6
|
+
/**
|
|
7
|
+
* 处理快手评论数据。
|
|
8
|
+
*
|
|
9
|
+
* 这里不再拼 HTML,而是输出共享富文本 JSON,交给 template 侧渲染 React 节点。
|
|
10
|
+
*
|
|
11
|
+
* amagi 把评论换到 H5 `photo/comment/list` 之后形状变了三处,且按「不归一化」原样透出:
|
|
12
|
+
* 条目从 `data.visionCommentList.rootComments` 提到顶层 `rootComments`、字段名从
|
|
13
|
+
* camelCase 变成 snake_case、子评论从内嵌的 `subComments` 挪到了 `subCommentsMap`。
|
|
14
|
+
* 本函数只用到根评论和 `subCommentCount` 这个计数,所以 `subCommentsMap` 暂不读。
|
|
15
|
+
*/
|
|
16
|
+
const kuaishouComments = async (data, emojiData) => {
|
|
17
|
+
const rootComments = data?.rootComments;
|
|
18
|
+
if (!Array.isArray(rootComments) || rootComments.length === 0) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const comments = rootComments.map((comment) => ({
|
|
22
|
+
// 生成类型里 `comment_id` 是数字(H5 这条的 id 就是数字),模板侧要字符串
|
|
23
|
+
cid: String(comment.comment_id ?? ''),
|
|
24
|
+
aweme_id: String(comment.comment_id ?? ''),
|
|
25
|
+
nickname: comment.author_name ?? '',
|
|
26
|
+
userimageurl: comment.headurl ?? '',
|
|
27
|
+
text: buildKuaishouRichText(comment.content ?? '', emojiData),
|
|
28
|
+
// H5 这条**没有** `realLikedCount`(那是 PC GraphQL 独有的真实点赞数),只剩展示用的
|
|
29
|
+
// `likedCount`,还可能是「1.2万」这种字符串 —— 解不出数字就沿用原有的兜底值 0
|
|
30
|
+
digg_count: Number(comment.likedCount) || 0,
|
|
31
|
+
create_time: comment.timestamp ?? 0,
|
|
32
|
+
reply_comment_total: comment.subCommentCount ?? 0
|
|
33
|
+
}));
|
|
34
|
+
return comments.sort((a, b) => b.digg_count - a.digg_count).slice(0, Math.min(comments.length, Config_1.Config.kuaishou.numcomment));
|
|
35
|
+
};
|
|
36
|
+
exports.kuaishouComments = kuaishouComments;
|
|
37
|
+
/**
|
|
38
|
+
* 把快手评论正文解析成共享富文本 JSON。
|
|
39
|
+
*
|
|
40
|
+
* 当前主要兼容:
|
|
41
|
+
* - `[表情]` 形式的平台表情;
|
|
42
|
+
* - `@昵称(uid)` 形式的提及;
|
|
43
|
+
* - 评论里的换行与空格。
|
|
44
|
+
*/
|
|
45
|
+
const buildKuaishouRichText = (text, emojiData) => {
|
|
46
|
+
const normalizedText = typeof text === 'string' ? text : String(text || '');
|
|
47
|
+
const emojiTokens = [...emojiData].sort((a, b) => b.name.length - a.name.length);
|
|
48
|
+
const nodes = [];
|
|
49
|
+
let buffer = '';
|
|
50
|
+
let index = 0;
|
|
51
|
+
const pushBuffer = () => {
|
|
52
|
+
if (buffer.length > 0) {
|
|
53
|
+
nodes.push((0, richtext_1.createTextNode)(buffer));
|
|
54
|
+
buffer = '';
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
while (index < normalizedText.length) {
|
|
58
|
+
if (normalizedText[index] === '\r') {
|
|
59
|
+
pushBuffer();
|
|
60
|
+
index += normalizedText[index + 1] === '\n' ? 2 : 1;
|
|
61
|
+
nodes.push((0, richtext_1.createLineBreakNode)());
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (normalizedText[index] === '\n') {
|
|
65
|
+
pushBuffer();
|
|
66
|
+
nodes.push((0, richtext_1.createLineBreakNode)());
|
|
67
|
+
index += 1;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const mentionMatch = normalizedText.slice(index).match(/^@([^()]+?)\(([^)]+)\)/);
|
|
71
|
+
if (mentionMatch) {
|
|
72
|
+
pushBuffer();
|
|
73
|
+
const mentionText = `@${mentionMatch[1].trim()}`;
|
|
74
|
+
const mentionId = mentionMatch[2].trim() || undefined;
|
|
75
|
+
nodes.push((0, richtext_1.createMentionNode)(mentionText, mentionId));
|
|
76
|
+
index += mentionMatch[0].length;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const matchedEmoji = emojiTokens.find((item) => normalizedText.startsWith(item.name, index));
|
|
80
|
+
if (matchedEmoji) {
|
|
81
|
+
pushBuffer();
|
|
82
|
+
nodes.push((0, richtext_1.createEmojiNode)(matchedEmoji.name, matchedEmoji.url));
|
|
83
|
+
index += matchedEmoji.name.length;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
buffer += normalizedText[index];
|
|
87
|
+
index += 1;
|
|
88
|
+
}
|
|
89
|
+
pushBuffer();
|
|
90
|
+
return (0, richtext_1.createRichTextDocument)(nodes, { platform: 'kuaishou' });
|
|
91
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getKuaishouID = void 0;
|
|
4
|
+
const node_karin_1 = require("../../../compat/node-karin.js");
|
|
5
|
+
const module_1 = require("../../module");
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param url 分享链接
|
|
9
|
+
* @param log 输出日志,默认true
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
const getKuaishouID = async (url, log = true) => {
|
|
13
|
+
const longLink = await new module_1.Networks({ url }).getLongLink();
|
|
14
|
+
let result = {};
|
|
15
|
+
switch (true) {
|
|
16
|
+
case /photoId=(.*)/.test(longLink): {
|
|
17
|
+
const workid = /photoId=([^&]+)/.exec(longLink);
|
|
18
|
+
result = {
|
|
19
|
+
type: 'one_work',
|
|
20
|
+
photoId: workid ? workid[1] : undefined
|
|
21
|
+
};
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
// 匹配 kuaishou.com/short-video/{id} 格式的链接
|
|
25
|
+
case /kuaishou\.com\/short-video\/([^?]+)/.test(longLink): {
|
|
26
|
+
const workid = /short-video\/([^?]+)/.exec(longLink);
|
|
27
|
+
result = {
|
|
28
|
+
type: 'one_work',
|
|
29
|
+
photoId: workid ? workid[1] : undefined
|
|
30
|
+
};
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
default: {
|
|
34
|
+
node_karin_1.logger.warn('无法获取作品ID');
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (log) {
|
|
39
|
+
console.log(result);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
exports.getKuaishouID = getKuaishouID;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchKuaishouData = void 0;
|
|
4
|
+
const amagiClient_1 = require("../../module/utils/amagiClient");
|
|
5
|
+
/**
|
|
6
|
+
* 按数据类型取快手数据。
|
|
7
|
+
*
|
|
8
|
+
* 返回类型必须显式写出来:不写的话 TS 推出的是生成树的底层名(`Comments_V0` 这类),
|
|
9
|
+
* 而那些名字不出现在包外 —— 声明产物于是报 TS2883「inferred type cannot be named」。
|
|
10
|
+
* @param type - 数据类型
|
|
11
|
+
* @param opt - 该类型对应的参数(调用方是链接解析结果,字段随链接类型变化)
|
|
12
|
+
* @returns 按 type 分支的响应体
|
|
13
|
+
*/
|
|
14
|
+
const fetchKuaishouData = async (type, opt) => {
|
|
15
|
+
switch (type) {
|
|
16
|
+
case 'one_work': {
|
|
17
|
+
const VideoData = await amagiClient_1.kuaishouFetcher.fetchVideoWork({
|
|
18
|
+
photoId: opt.photoId
|
|
19
|
+
});
|
|
20
|
+
const CommentsData = await amagiClient_1.kuaishouFetcher.fetchWorkComments({
|
|
21
|
+
photoId: opt.photoId
|
|
22
|
+
});
|
|
23
|
+
const EmojiData = await amagiClient_1.kuaishouFetcher.fetchEmojiList();
|
|
24
|
+
return { VideoData: VideoData.data, CommentsData: CommentsData.data, EmojiData: EmojiData.data };
|
|
25
|
+
}
|
|
26
|
+
case 'work_comments': {
|
|
27
|
+
const CommentsData = await amagiClient_1.kuaishouFetcher.fetchWorkComments({
|
|
28
|
+
photoId: opt.photoId
|
|
29
|
+
});
|
|
30
|
+
return CommentsData.data;
|
|
31
|
+
}
|
|
32
|
+
case 'emoji_list': {
|
|
33
|
+
const EmojiData = await amagiClient_1.kuaishouFetcher.fetchEmojiList();
|
|
34
|
+
return EmojiData.data;
|
|
35
|
+
}
|
|
36
|
+
default: {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.fetchKuaishouData = fetchKuaishouData;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./comments"), exports);
|
|
18
|
+
__exportStar(require("./getdata"), exports);
|
|
19
|
+
__exportStar(require("./getID"), exports);
|
|
20
|
+
__exportStar(require("./kuaishou"), exports);
|