【问题标题】:How to get the id of the question or answer linked to a specific badge award?如何获取与特定徽章奖励相关的问题或答案的 ID?
【发布时间】:2019-11-15 15:16:08
【问题描述】:

我可以获取特定用户的徽章 ID,example query

Select *
From Badges
Where UserId = 10907521

结果中的示例徽章 ID

30884218

但是,如何为授予用户的每个徽章获取相关的问题或答案 ID(如果适用)?
对于那些与问答无关的徽章,我们可以期待“NA”。

【问题讨论】:

标签: stackexchange-api dataexplorer


【解决方案1】:

Badge awards and posts are not linked in SEDE;该信息在数据资源管理器中不可用。

您可以从 API 中获取它,尽管它并不漂亮。
参考:

例如抓取:

  /users/10907521/timeline?pagesize=100&site=stackoverflow

返回如下结果:

{
  "badge_id": 10,
  "post_id": 54438094,
  "user_id": 10907521,
  "timeline_type": "badge",
  "post_type": "question",
  "creation_date": 1548848111,
  "detail": "Scholar",
  "title": "Execute a command and save the results into a df from a loop"
}

一旦您在结果中过滤/搜索badge_id

【讨论】:

    猜你喜欢
    • 2018-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-02
    • 1970-01-01
    • 1970-01-01
    • 2018-09-27
    • 2021-07-02
    相关资源
    最近更新 更多