koishi-plugin-video-parser-all 0.3.9 → 0.4.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.
Files changed (2) hide show
  1. package/lib/index.js +5 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -12,9 +12,6 @@ const fs_1 = __importDefault(require("fs"));
12
12
  const path_1 = __importDefault(require("path"));
13
13
  const promises_1 = require("stream/promises");
14
14
  const worker_threads_1 = require("worker_threads");
15
- const __filename = typeof __dirname !== 'undefined'
16
- ? path_1.default.join(__dirname, 'index.js')
17
- : process.cwd() + '/index.js';
18
15
  exports.name = 'video-parser-all';
19
16
  exports.Config = koishi_1.Schema.intersect([
20
17
  koishi_1.Schema.object({
@@ -801,7 +798,6 @@ function apply(ctx, config) {
801
798
  }
802
799
  return { data: null, msg: '西瓜视频解析失败' };
803
800
  }
804
- // 修复:确保 currentPlatform 不为 null
805
801
  const currentPlatform = platform;
806
802
  const nonKuaishouPlatforms = ['xiaohongshu', 'weibo', 'toutiao', 'pipigx', 'pipixia', 'zuiyou'];
807
803
  if (nonKuaishouPlatforms.includes(currentPlatform)) {
@@ -809,7 +805,6 @@ function apply(ctx, config) {
809
805
  try {
810
806
  const res = await http.get(API_CONFIG.universal, { params: { url: realUrl } });
811
807
  if ((res.data.code === 200 || res.data.code === 0) && res.data.data) {
812
- // currentPlatform 已经被断言为非 null,安全传递给 parseData
813
808
  const parseResult = parseData(res.data.data, config.maxDescLength, currentPlatform);
814
809
  return { data: parseResult, msg: '解析成功' };
815
810
  }
@@ -1130,3 +1125,8 @@ function apply(ctx, config) {
1130
1125
  process.on('exit', clearAllCache);
1131
1126
  ctx.logger.info('视频解析插件已加载');
1132
1127
  }
1128
+ module.exports = {
1129
+ name: exports.name,
1130
+ Config: exports.Config,
1131
+ apply,
1132
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-video-parser-all",
3
3
  "description": "Koishi 全平台视频解析插件,支持抖音/快手/B站/小红书/微博/今日头条/皮皮搞笑/皮皮虾/西瓜视频/最右视频链接解析",
4
- "version": "0.3.9",
4
+ "version": "0.4.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [