【问题标题】:Is it possible to use the Disqus API to get comments from a specific url?是否可以使用 Disqus API 从特定 url 获取评论?
【发布时间】:2011-06-12 22:05:26
【问题描述】:

如果可能,我还想使用 javascript 客户端脚本来执行此操作。

【问题讨论】:

    标签: javascript json cross-domain disqus


    【解决方案1】:

    您总是可以使用 jQuery 进行 AJAX 调用,因为 Disqus 上的几乎所有内容现在都已获取。

    首先,您必须使用 (http://disqus.com/api/docs/threads/list/) 获取线程 ID:

    http://disqus.com/api/3.0/threads/list.json?api_key=API_PUBLIC_KEY_HERE&forum=[shortforumid]&thread=link:[link]

    最重要的部分是 thread= 有 link:[link] 作为链接:表示我们正在使用 URL。

    获取线程ID后,你必须访问(http://disqus.com/api/docs/posts/list/):

    http://disqus.com/api/3.0/posts/list.json?api_key=API_PUBLIC_KEY_HERE&thread=[线程ID]

    提醒一下,您不需要放在括号中...

    【讨论】:

    • 线程必须是整数...你传递的线程是什么? [thread id] 部分是您插入线程 id(整数)的位置。
    • 嗨 Jaime 你能看看我的问题吗? stackoverflow.com/questions/42403477/…
    • 你的答案正是我想要的,但由于某种原因我无法让它发挥作用
    • @HamedMinaee - 抱歉,我刚看到这个,你有什么代码可以帮上忙吗?我不太确定问题是什么。我已经有一段时间没有使用过 Disqus,所以 API 可能发生了变化。
    • 谢谢。您的 API 调用对我有用。 shortforumid 是您网站的简称(查看您在 WP 中的站点配置下的 Disqus 设置)
    【解决方案2】:

    接受的答案包括对 Disqus API 的 2 次不同调用,以避免限制使用,您只能使用 1 次调用来通过 url 获取 cmets 列表:

    http://disqus.com/api/3.0/posts/list.json?api_key=API_PUBLIC_KEY_HERE&forum=[shortforumid]&thread=link:[link]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-12
      • 1970-01-01
      • 1970-01-01
      • 2013-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多