I find I\'m often unsatisfied with the ordering and expressiveness of searches on https://www.npmjs.com/. I guess there should be a way to programmatically query the server
I know that this answer is old but some can still find it relevant so:
After a lot of searching, I finally found something, The solution doesn’t use NPM API because of its bad documentation and many more disadvantages that it has
(This will be helpful for other usages other than searching like getting a list of popular packages (what I needed))
The solution is to use Libraries.io
Libraries.io indexes data from 4,273,741 packages from 36 package managers. (Including NPM) From Libraries.io page
It has great API and good documentation, also it has some API wrapper in several languages
You can take a look at my CLI program that uses that library here