koishi-plugin-video-parser-all 0.7.2 → 0.7.3
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 +25 -23
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -100,27 +100,27 @@ const API_CONFIG = {
|
|
|
100
100
|
zuiyou: 'https://api.bugpk.com/api/zuiyou'
|
|
101
101
|
};
|
|
102
102
|
const VARIABLE_MAPPING = {
|
|
103
|
-
'标题': ['title', 'note_title', 'content_title', 'item.title', 'data.title', 'video.title', 'live.title', 'data.item.title', 'data.live.title'],
|
|
104
|
-
'作者': ['author', 'author.name', 'name', 'nickname', 'user_name', 'owner.name', 'data.author', 'item.author', 'user.name', 'live.author', 'data.user.name', 'data.author.name'],
|
|
105
|
-
'简介': ['desc', 'description', 'content', 'note_desc', 'text', 'data.desc', 'item.description', 'live.desc', 'data.item.description'],
|
|
106
|
-
'视频时长': ['duration', 'time', 'video_duration', 'item.duration', 'stat.duration', 'data.item.duration'],
|
|
107
|
-
'点赞数': ['like', 'attitudes_count', 'digg_count', 'praise', 'stat.like', 'liked_count', 'data.like', 'data.attitudes_count', 'item.attitudes_count', 'data.item.attitudes_count'],
|
|
108
|
-
'投币数': ['coin', 'bi', 'stat.coin', 'stast.coin'],
|
|
109
|
-
'收藏数': ['collect', 'favorite', 'star', 'stat.collect', 'collected_count', 'stast.favorite', 'data.favorite'],
|
|
110
|
-
'转发数': ['share', 'forward', 'repost', 'stat.share', 'reposts_count', 'shared_count', 'stast.share', 'data.reposts_count', 'data.item.reposts_count'],
|
|
111
|
-
'播放数': ['view', 'play_count', 'play', 'stat.view', 'play_times', 'stast.view', 'data.play_count', 'item.play_count', 'data.item.play_count'],
|
|
112
|
-
'评论数': ['comment', 'comments_count', 'comment_count', 'discuss', 'stat.comment', 'stast.reply', 'data.comments_count', 'item.comments_count', 'data.item.comments_count', 'stat.reply'],
|
|
113
|
-
'IP属地': ['ip_info_str', 'data.ip_info_str', 'item.ip_info', 'data.item.ip_info_str'],
|
|
114
|
-
'发布时间': ['date', 'time', 'publish_time', 'data.date', 'item.publish_time', 'live.time', 'stast.publish_time', 'stat.time', 'data.time.publish_time', 'data.live.time', 'stat.ctime'],
|
|
115
|
-
'粉丝数': ['followers_count', 'data.followers_count', 'item.followers', 'author.fans', 'data.item.followers_count'],
|
|
116
|
-
'在线人数': ['online', 'data.online', 'live.online', 'room.online', 'data.live.online'],
|
|
117
|
-
'关注数': ['attention', 'data.attention', 'live.attention', 'stast.attention', 'data.live.attention'],
|
|
118
|
-
'文件大小': ['size', 'size_str', 'item.size', 'item.size_str', 'data.size', 'data.item.size_str'],
|
|
119
|
-
'直播间地址': ['room_url', 'live.room_url', 'data.room_url', 'live.url', 'data.live.room_url'],
|
|
120
|
-
'直播间ID': ['room_id', 'live.room_id', 'data.room_id', 'live.room_id', 'data.live.room_id'],
|
|
121
|
-
'直播间状态': ['status', 'live.status', 'data.status', 'room.status', 'data.live.status'],
|
|
122
|
-
'图片数量': ['count', 'data.count', 'item.count', 'images.length', 'data.images.length', 'data.item.count'],
|
|
123
|
-
'作者ID': ['userId', 'userID', 'author_id', 'data.userId', 'item.userID', 'author.mid', 'user.mid', 'data.item.userID', 'data.author_id', 'data.user.mid', 'author.id', 'uid', '
|
|
103
|
+
'标题': ['title', 'note_title', 'content_title', 'item.title', 'data.title', 'video.title', 'live.title', 'data.item.title', 'data.live.title', 'data.note.title', 'data.video_info.title', 'data.aweme_info.title', 'data.video_data.title', 'data.post_title', 'data.article_title', 'data.video_title', 'data.work_title', 'data.media_title', 'data.caption'],
|
|
104
|
+
'作者': ['author', 'author.name', 'name', 'nickname', 'user_name', 'owner.name', 'data.author', 'item.author', 'user.name', 'live.author', 'data.user.name', 'data.author.name', 'data.note.author', 'data.user', 'data.user_info', 'data.owner_info', 'data.creator', 'data.username', 'data.author_name', 'data.user_nickname', 'data.publisher', 'data.uploader'],
|
|
105
|
+
'简介': ['desc', 'description', 'content', 'note_desc', 'text', 'data.desc', 'item.description', 'live.desc', 'data.item.description', 'data.note.desc', 'data.caption', 'data.detail', 'data.intro', 'data.introduce', 'data.summary', 'data.video_desc', 'data.post_content', 'data.article_content'],
|
|
106
|
+
'视频时长': ['duration', 'time', 'video_duration', 'item.duration', 'stat.duration', 'data.item.duration', 'data.video_duration', 'data.video_time', 'data.play_time', 'data.length', 'data.video_length'],
|
|
107
|
+
'点赞数': ['like', 'attitudes_count', 'digg_count', 'praise', 'stat.like', 'liked_count', 'data.like', 'data.attitudes_count', 'item.attitudes_count', 'data.item.attitudes_count', 'data.like_count', 'data.likes', 'data.praise_count', 'data.digg', 'data.favorited_count', 'data.love_count', 'data.up_count', 'data.zan'],
|
|
108
|
+
'投币数': ['coin', 'bi', 'stat.coin', 'stast.coin', 'data.coin', 'data.coin_num', 'data.coin_count'],
|
|
109
|
+
'收藏数': ['collect', 'favorite', 'star', 'stat.collect', 'collected_count', 'stast.favorite', 'data.favorite', 'data.collect_count', 'data.collection_count', 'data.star_count', 'data.bookmark_count', 'data.fav_count', 'data.save_count'],
|
|
110
|
+
'转发数': ['share', 'forward', 'repost', 'stat.share', 'reposts_count', 'shared_count', 'stast.share', 'data.reposts_count', 'data.item.reposts_count', 'data.share_count', 'data.forward_count', 'data.repost_count'],
|
|
111
|
+
'播放数': ['view', 'play_count', 'play', 'stat.view', 'play_times', 'stast.view', 'data.play_count', 'item.play_count', 'data.item.play_count', 'data.view_count', 'data.views', 'data.play_num', 'data.watch_count', 'data.video_play_count'],
|
|
112
|
+
'评论数': ['comment', 'comments_count', 'comment_count', 'discuss', 'stat.comment', 'stast.reply', 'data.comments_count', 'item.comments_count', 'data.item.comments_count', 'stat.reply', 'data.comment_num', 'data.reply_count', 'data.review_count'],
|
|
113
|
+
'IP属地': ['ip', 'ip_info', 'ip_location', 'ip_info_str', 'data.ip_info_str', 'item.ip', 'item.ip_info', 'data.item.ip_info_str', 'data.user_ip', 'data.location', 'data.region', 'data.area', 'data.addr'],
|
|
114
|
+
'发布时间': ['date', 'time', 'publish_time', 'create_time', 'ctime', 'pubdate', 'data.date', 'item.publish_time', 'live.time', 'stast.publish_time', 'stat.time', 'data.time.publish_time', 'data.live.time', 'stat.ctime', 'data.upload_time', 'data.post_time', 'data.create_date', 'data.pub_time', 'data.timestamp'],
|
|
115
|
+
'粉丝数': ['fans', 'fans_count', 'follower', 'followers', 'follower_count', 'followers_count', 'data.followers_count', 'item.followers', 'author.fans', 'data.item.followers_count', 'data.user_fans', 'data.fan_num'],
|
|
116
|
+
'在线人数': ['online', 'online_count', 'data.online', 'live.online', 'room.online', 'data.live.online', 'data.watching', 'data.viewer_count', 'data.audience_count'],
|
|
117
|
+
'关注数': ['follow', 'follow_count', 'attention', 'data.attention', 'live.attention', 'stast.attention', 'data.live.attention', 'data.following_count', 'data.follow_num'],
|
|
118
|
+
'文件大小': ['size', 'size_str', 'item.size', 'item.size_str', 'data.size', 'data.item.size_str', 'data.file_size', 'data.video_size', 'data.vid_size'],
|
|
119
|
+
'直播间地址': ['room_url', 'live.room_url', 'data.room_url', 'live.url', 'data.live.room_url', 'data.room_link', 'data.live_url', 'data.stream_url'],
|
|
120
|
+
'直播间ID': ['room_id', 'live.room_id', 'data.room_id', 'live.room_id', 'data.live.room_id', 'data.live_id', 'data.stream_id'],
|
|
121
|
+
'直播间状态': ['status', 'live_status', 'live.status', 'data.status', 'room.status', 'data.live.status', 'data.stream_status', 'data.room_status'],
|
|
122
|
+
'图片数量': ['count', 'img_count', 'image_count', 'pic_count', 'data.count', 'item.count', 'images.length', 'data.images.length', 'data.item.count', 'data.pic_num', 'data.img_num'],
|
|
123
|
+
'作者ID': ['uid', 'userid', 'user_id', 'userId', 'userID', 'author_id', 'data.userId', 'item.userID', 'author.mid', 'user.mid', 'data.item.userID', 'data.author_id', 'data.user.mid', 'author.id', 'short_id', 'data.author.id', 'data.uid', 'data.mid', 'data.open_id', 'data.account_id']
|
|
124
124
|
};
|
|
125
125
|
function getErrorMessage(error) {
|
|
126
126
|
if (error instanceof Error)
|
|
@@ -585,7 +585,9 @@ function generateFormattedText(parseData, config) {
|
|
|
585
585
|
result = result.replace(varMatch, String(value));
|
|
586
586
|
}
|
|
587
587
|
});
|
|
588
|
-
return result.trim() || `标题:${parseData.title}
|
|
588
|
+
return result.trim() || `标题:${parseData.title}
|
|
589
|
+
作者:${parseData.author}
|
|
590
|
+
简介:${parseData.desc}`;
|
|
589
591
|
}
|
|
590
592
|
function clearAllCache() {
|
|
591
593
|
processed.clear();
|
|
@@ -715,7 +717,7 @@ function apply(ctx, config) {
|
|
|
715
717
|
}
|
|
716
718
|
}
|
|
717
719
|
async function processSingleUrl(session, url) {
|
|
718
|
-
const hash = crypto_1.default.createHash('md5').update(url
|
|
720
|
+
const hash = crypto_1.default.createHash('md5').update(url).digest('hex');
|
|
719
721
|
const now = Date.now();
|
|
720
722
|
if (processed.get(hash) && now - processed.get(hash) < config.sameLinkInterval * 1000) {
|
|
721
723
|
logger.warn(`相同链接重复解析: ${url}`);
|
package/package.json
CHANGED