2015-10-17 63 views
0

我正在使用atmospherejs.com搜索軟件包,但不幸的是,它沒有提供任何標準來對結果進行排序:例如,如果我想按下載次數排序。atmospherejs.com:結果搜索按下載次數排序

反正是有得到一些標準排序的查詢結果:下載,評級,新的包的數量等

感謝

+0

http://ww2.meteor.com/spreadjs/linto –

+0

也有其他的方法來GE這完成:http://stackoverflow.com/questions/27057578/does-atmospherejs-provide-any-apis –

+0

謝謝@ChristianFritz這將有所幫助。顯然,它應該這樣做,因爲它是不可能分類的。 –

回答

0

我不這麼認爲,但你可以使用氣氛API來獲取原始數據,然後篩選和排序:

# get raw data 
curl --header "Accept: application/json" https://atmospherejs.com/a/packages > /tmp/all.json 

# process the json array in whatever way you want, for instance here 
# only consider packages starting with an "f", then sort by installs per year 
node -e "x = require('/tmp/all.json'); \ 
    console.log(x.filter(function(a) { return a.name[0] == 'f'; })\ 
    .sort(function(a,b) { return a['installs-per-year'] < b['installs-per-year']; }));"