Giter Site home page Giter Site logo

当前文章评论数调用 about twikoo HOT 5 OPEN

twikoojs avatar twikoojs commented on May 22, 2024
当前文章评论数调用

from twikoo.

Comments (5)

heson525 avatar heson525 commented on May 22, 2024

这个就厉害了😹

from twikoo.

wztlink1013 avatar wztlink1013 commented on May 22, 2024

可否写一个调用 文章访问量/评论数 的API,类似最新评论一样

我觉得这里面不好权衡的就是,文章一多(比如500篇)就会对云数据库Counter集合查询带来压力、免费资源耗费多,但是感觉云函数处理性能,貌似也可以接受?

@imaegoo

from twikoo.

imaegoo avatar imaegoo commented on May 22, 2024

可否写一个调用 文章访问量/评论数 的API,类似最新评论一样

@wztlink1013

  1. 文章访问量 API,还没有
  2. 文章评论数 API,已经有了:https://twikoo.js.org/api.html#get-comments-count
  3. API 是批量获取,不会消耗大量免费资源的
  4. 文章多了可以分页获取,不要一次获取 500 个数据,因为云开发数据库一次只能获取100条

from twikoo.

wztlink1013 avatar wztlink1013 commented on May 22, 2024

可否写一个调用 文章访问量/评论数 的API,类似最新评论一样

@wztlink1013

  1. 文章访问量 API,还没有
  2. 文章评论数 API,已经有了:https://twikoo.js.org/api.html#get-comments-count
  3. API 是批量获取,不会消耗大量免费资源的
  4. 文章多了可以分页获取,不要一次获取 500 个数据,因为云开发数据库一次只能获取100条

那有什么方法可以批量获取各文章的访问量吗?
将资源文件夹下的所有文章url存到一个数组,然后再对其进行循环获取各个文章下的twikoo_visitors访问量?

https://7.dusays.com/2021/03/31/c9325daf53ffe.png【截图】

from twikoo.

imaegoo avatar imaegoo commented on May 22, 2024

那有什么方法可以批量获取各文章的访问量吗?
将资源文件夹下的所有文章url存到一个数组,然后再对其进行循环获取各个文章下的twikoo_visitors访问量?

https://7.dusays.com/2021/03/31/c9325daf53ffe.png【截图】

@wztlink1013 需要写一个新的 API 来获取文章的访问量。但是很抱歉,工作原因,最近没有时间维护 twikoo,你可以参照获取评论数的接口代码,开发一个获取访问量的接口。

https://github.com/imaegoo/twikoo/blob/cabb841d614857c4f30fecfb5cae09e5808b0796/src/function/twikoo/index.js#L1265

from twikoo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.