gpt4 book ai didi

javascript - 如何查询NPM REST API搜索以获得相关结果?

转载 作者:行者123 更新时间:2023-12-03 00:04:47 25 4
gpt4 key购买 nike

我正在寻找一种查询npm REST API以返回相关结果的方法。我想将搜索整合到我的应用中。

F.e.如果我在npm中查询“bootstrap”,则会收到一堆结果,但是在首页上的twitter bootstrap包中而不是:

请求
curl https://npmsearch.com/query?q=bootstrap&fields=name,description,rating,version
结果
{"results":[{"name":["apta-bootstrap"],"version":["1.0.0"],"description":["apta bootstrap assets"]},{"name":["ender-bootstrap"],"version":["2.2.1"],"description":["Ender version of Twitter's Bootstrap JS (all plugins)"]},{"name":["bootstrap-extends"],"version":["1.0.1"],"description":["Useful extensions for Bootstrap 3"]},{"name":["bootstrap-submenu-hover"],"version":["2.0.8"],"description":["Bootstrap Sub-Menus"]},{"name":["bootstrap-submenu"],"version":["2.0.4"],"description":["Bootstrap Sub-Menus"]},{"name":["bootstrap-toggle-react"],"version":["0.1.6"],"description":["Bootstrap Toggle is a react component providing a toggle, based on www.bootstraptoggle.com"]},{"name":["bootstrap-layout-scrollable"],"version":["1.1.0"],"description":["Bootstrap Layout integration with Simplebar.js"]},{"name":["mithril-admin-bootstrap"],"version":["0.0.2"],"description":["Twitter Bootstrap plugin for mithril-admin"]},{"name":["bootstrap-checkbox"],"version":["1.4.0"],"description":["A checkbox component based on Bootstrap framework"]},{"name":["npmdoc-bootstrap-notify"],"version":["0.0.2"],"description":["#### api documentation for [bootstrap-notify (v3.1.3)](http://bootstrap-notify.remabledesigns.com/) [![npm package](https://img.shields.io/npm/v/npmdoc-bootstrap-notify.svg?style=flat-square)](https://www.npmjs.org/package/npmdoc-bootstrap-notify) [![tr"]}],"total":13546,"from":0}
如何提高NPM搜索的实用性?

yarnpkg.com在提供出色的搜索方面做得很好,但是该搜索似乎不打算公开访问,即
https://yarnpkg.com/en/packages?q=bootstrap&p=1

你有什么建议吗?

谢谢。

最佳答案

要查询npm软件包信息,可以使用npmjs.com的搜索URL:

 http://npmjs.com/-/search?text=<search keyword>

对于Bootstrap,它是:
http://npmjs.com/-/search?text=bootstrap 

twitter Bootstrap将是最好的结果。

关于javascript - 如何查询NPM REST API搜索以获得相关结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45895045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com