yz-yuki-plugin 2.0.10-1 → 2.0.10-2

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/apps/weibo.js CHANGED
@@ -310,18 +310,25 @@ message.use(async (e) => {
310
310
  const result = data?.cards
311
311
  ?.filter(card => card?.card_type === 11) // 筛选 card_type = 11
312
312
  ?.flatMap(card => (Array.isArray(card.card_group) ? card.card_group : [])) // 提取 card_group
313
- ?.filter(item => item?.card_type === 10) || []; // 筛选 card_type = 10
314
- if (!result) {
313
+ ?.flatMap(item => {
314
+ if (Array.isArray(item?.users)) {
315
+ return item.users;
316
+ }
317
+ if (item?.user) {
318
+ return [item.user];
319
+ }
320
+ return [];
321
+ }) || []; // 筛选 card_type = 10 user 或 card_type = 3 users
322
+ if (!result.length) {
315
323
  e.reply('惹~没有搜索到相关用户捏,\n请换个关键词试试吧~ \nPS:该方法只能搜索到大V');
316
324
  return;
317
325
  }
318
326
  const messages = [];
319
327
  // 只取前5个结果
320
- for (const item of result.slice(0, 5)) {
321
- const userInfo = item?.user || {};
328
+ for (const userInfo of result.slice(0, 5)) {
322
329
  const id = userInfo.id;
323
330
  const screen_name = userInfo.screen_name;
324
- const followers_count = userInfo.followers_count;
331
+ const followers_count = userInfo.followers_count || userInfo.followers_count_str || '';
325
332
  messages.push(`\n------------------\n博主昵称:${screen_name}\nUID:${id}\n粉丝人数:${followers_count || ''}`);
326
333
  }
327
334
  e.reply(messages.join('\n'));
@@ -62,7 +62,7 @@ class WeiboWebDataFetcher {
62
62
  }
63
63
  /**通过关键词搜索微博大v */
64
64
  async searchBloggerInfo(keyword) {
65
- const params = { containerid: '100103', type: '3', q: `${keyword}`, t: '', page_type: 'searchall' };
65
+ const params = { containerid: '100103', type: '1', q: `${keyword}`, page_type: 'searchall' };
66
66
  const url = new URL(WeiboApi.WEIBO_API.weiboGetIndex);
67
67
  url.search = new URLSearchParams(params).toString();
68
68
  const jar = await WeiboCookieManager.getSessionCookieJar();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.10-1",
3
+ "version": "2.0.10-2",
4
4
  "description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
5
5
  "author": "snowtafir",
6
6
  "type": "module",