koishi-plugin-video-parser-all 0.6.7 → 0.6.8
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/index.js +26 -14
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -391,7 +391,6 @@ function formatPublishTime(value) {
|
|
|
391
391
|
if (!value)
|
|
392
392
|
return '';
|
|
393
393
|
const str = String(value).trim();
|
|
394
|
-
// 适配B站的 ctime 时间戳字段名(避免直接传入字符串"ctime")
|
|
395
394
|
if (value === 'ctime')
|
|
396
395
|
return '';
|
|
397
396
|
if (/^\d{10}$/.test(str)) {
|
|
@@ -529,11 +528,12 @@ function parseData(rawResponse, maxDescLength) {
|
|
|
529
528
|
stat['发布时间'] = pubTime;
|
|
530
529
|
else
|
|
531
530
|
delete stat['发布时间'];
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
else
|
|
531
|
+
if (durationFormatted !== '00:00:00') {
|
|
532
|
+
stat['视频时长'] = durationFormatted;
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
536
535
|
delete stat['视频时长'];
|
|
536
|
+
}
|
|
537
537
|
const sizeVal = stat['文件大小'];
|
|
538
538
|
if (sizeVal && !String(sizeVal).includes('MB')) {
|
|
539
539
|
const num = Number(sizeVal);
|
|
@@ -560,7 +560,6 @@ function parseData(rawResponse, maxDescLength) {
|
|
|
560
560
|
stat['粉丝数'] = data.followers_count;
|
|
561
561
|
if (data.ip_info_str)
|
|
562
562
|
stat['IP属地'] = data.ip_info_str;
|
|
563
|
-
// 处理小红书视频备用链接
|
|
564
563
|
if (data.video_backup)
|
|
565
564
|
stat['视频备用链接'] = data.video_backup;
|
|
566
565
|
return {
|
|
@@ -666,14 +665,27 @@ function apply(ctx, config) {
|
|
|
666
665
|
for (let i = 0; i <= retryTimes; i++) {
|
|
667
666
|
try {
|
|
668
667
|
const params = { url, proxyurl: '' };
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
668
|
+
let res;
|
|
669
|
+
if (platform === 'xiaohongshu') {
|
|
670
|
+
res = await http.post(API_CONFIG[platform], new URLSearchParams(params), {
|
|
671
|
+
timeout: config.timeout,
|
|
672
|
+
headers: {
|
|
673
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
674
|
+
'Origin': 'https://api.bugpk.com',
|
|
675
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
res = await http.get(API_CONFIG[platform], {
|
|
681
|
+
params,
|
|
682
|
+
timeout: config.timeout,
|
|
683
|
+
headers: {
|
|
684
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
685
|
+
'Origin': 'https://www.baidu.com'
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
}
|
|
677
689
|
return res.data;
|
|
678
690
|
}
|
|
679
691
|
catch (error) {
|
package/package.json
CHANGED