אני רוצה לקבל את מספר המשתמשים הפעילים דרך ה-API, זהה בדיוק למה שמיוצא, דרך איזה API עלי לקבל זאת?
סיכום מבוסס בינה מלאכותית
用户 zhang_zhiyuan 询问如何通过API获取所有活跃用户数量,与导出的数据一致。 NateDhaliwal 确认是指当前在线用户,而 zhang_zhiyuan 解释是指网站所有有效用户数。 Lilly 提到 /admin/users/list/active.json API,并提供相关文档链接。 NateDhaliwal 建议使用 {site url}/about.json 获取 users_count。 zhang_zhiyuan 发现通过API获取的用户数量与 users_count 不符,并希望分析原因。 NateDhaliwal 建议使用 listUsersPublic API。 Moin 和 NateDhaliwal 建议使用分页参数获取所有用户数据。 pfaffman 建议使用数据探索器查询。最终,zhang_zhiyuan 确认差异是因为API默认条件只获取活跃用户。
פעיל במובן של מה: יומי, שבועי, חודשי או שנתי?
כדי לקבל את כל המשתמשים הפעילים כעת, כלומר את סך המשתמשים
אז אתה מתכוון לכל המשתמשים המקוונים, כלומר אלה שנמצאים כרגע בפורום באותו זמן?
what about /admin/users/list/active.json?
maybe this doc will help?
https://docs.discourse.org/#tag/Users/operation/adminListUsers
also see
לא, זה מספר המשתמשים הפעילים באתר, כלומר כמה אנשים יש כרגע באתר.
You can pull the data from {site url}/about.json, and get the users_count key’s value. For example on Meta:
{
"about": {
"stats": {
"topics_last_day": 16,
"topics_7_days": 99,
"topics_30_days": 553,
"topics_count": 60801,
"posts_last_day": 549,
"posts_7_days": 3352,
"posts_30_days": 19273,
"posts_count": 1722045,
"users_last_day": 23,
"users_7_days": 132,
"users_30_days": 713,
"users_count": 61086, // This value here!
"active_users_last_day": 535,
"active_users_7_days": 1219,
"active_users_30_days": 2518,
"likes_last_day": 169,
"likes_7_days": 1547,
"likes_30_days": 10833,
"likes_count": 1641538,
"participating_users_last_day": 119,
"participating_users_7_days": 373,
"participating_users_30_days": 912,
"visitors_last_day": 2161,
"visitors_7_days": 4468,
"visitors_30_days": 8669,
"eu_visitors_last_day": 653,
"eu_visitors_7_days": 1206,
"eu_visitors_30_days": 2022,
"chat_messages_last_day": 72,
"chat_messages_7_days": 707,
"chat_messages_30_days": 3015,
"chat_messages_previous_30_days": 3621,
"chat_messages_count": 99670,
"chat_users_last_day": 8,
"chat_users_7_days": 27,
"chat_users_30_days": 67,
"chat_users_previous_30_days": 87,
"chat_users_count": 925,
"chat_channels_last_day": 3,
"chat_channels_7_days": 8,
"chat_channels_30_days": 39,
"chat_channels_previous_30_days": 36,
"chat_channels_count": 3117
},
"description": "Learn about and discuss Discourse, the next-generation open-source forum software.",
"extended_site_description": "<p>A place for the Discourse community to meet, ask questions, provide support to one other, and share much-appreciated feedback.</p>",
"banner_image": "https://global.discourse-cdn.com/meta/original/4X/8/3/5/835377a3ea23f75e6c6c08ed3d7d606a0f2c3e72.jpeg",
"site_creation_date": "2016-02-17T07:50:40.228Z",
"title": "Discourse Meta",
"locale": "en",
"version": "3.6.0.beta1-dev",
"https": true,
"can_see_about_stats": true,
"contact_url": "",
"contact_email": "team@discourse.org",
"moderator_ids": [
127856,
112395,
8307,
8571,
140271
],
"admin_ids": [],
"category_moderators": []
}
}
the users_count number is 61086.
כן, כרגע אני משתמש בנתוני המשתמשים המתקבלים מה-API כאן, אך זה לא תואם את הכמות הכוללת של users_count ב-Meta: {site url}/about.json. אני רוצה לנתח את הסיבה לכך.
This is to get the total number of users, but I want to get the user list. This is because the number of users I get from https://docs.discourse.org/#tag/Users/operation/adminListUsers is not the same as the users_count from {site url}/about.json, and many users are missing.
Hi there, what about this (Discourse Docs) API call? For example, https://meta.discourse.org/directory_items.json?period=all&order=likes_received gets all the users ordered by likes. You can add &page=2, &page=3 at the back for more pages of users.
Did you use the page parameter to get all pages?
כן, קבלת נתונים מדפי תוצאות עד שלא יוחזרו נתונים נוספים, למשל, אם יש 34,000+ רשומות בסך הכל, אך מתקבלות רק 30,000+, איני יכול להבחין אילו משתמשים אינם ניתנים לאחזור דרך ממשק ה-API.
אז מה אם תעבור בלולאה על כל עמוד (אולי באמצעות משהו כמו פייתון) כדי להגדיל את מספר העמוד ולאחזר את הנתונים עד שלא יישארו נתונים לאחזור? האם זה יעבוד?
I think using a data explorer query would be the easiest way to get the whole user list.
כן, זה טופל. ההבדל הקודם נבע מכך שהשתמשתי בתנאים ברירת מחדל בעת קבלת נתונים דרך ה-API, מה שהחזיר רק משתמשים פעילים.