是否有任何命令行界面archlinux 软件包使用统计?我看了看蚂蚁pkgstats
,找不到任何这样的选项。
我想要这样的东西:
$ statpkg kitty
1392: kitty
95: kitty-git
74: kitty-framework
8: kittypack-git
答案1
当您访问链接到的页面时,打开浏览器的网络选项卡(按Ctrl+ shift+c并转到网络选项卡),然后刷新。其中一个请求返回 JSON 响应。右键单击它并复制该网址,您可以使用它来下载数据。
curl
然后,您可以使用和定义手动函数,awk
如下所示:
statpkg(){
curl -s "https://pkgstats.archlinux.de/package/datatables?draw=4&columns%5B0%5D%5Bdata%5D=pkgname&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=false&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=count&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=false&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=1&order%5B0%5D%5Bdir%5D=desc&start=0&length=25&search%5Bvalue%5D=$1&search%5Bregex%5D=false&_=1559313142337" |
awk 'BEGIN{RS="[{}]";FS="[\":]"} {if ($9) print $9": "$5}'
}
用法示例:
$ statpkg awesome
2452: ttf-font-awesome
1913: awesome-terminal-fonts
1835: awesome
1347: otf-font-awesome
652: ttf-font-awesome-4
649: python-qtawesome
409: python2-qtawesome
368: otf-font-awesome-4
302: fontawesome.sty
101: plasma5-applet-awesome-widgets
75: awesome-terminal-fonts-git
65: awesome-themes-git
60: awesome-freedesktop-git
57: awesome-terminal-fonts-patched
54: awesome-git
48: otf-font-awesome-5-free
43: awesome-revelation-git
34: awesome-luajit-git
28: awesomebump
25: python-qtawesome-git
24: awesome-gnome
21: awesome-scratch-git
18: otf-fontawesome
15: awesome-cinnamon
15: blackarch-config-awesome