王一之 发表于 2022-5-25 14:53:12

脚本数据徽章

如果逛GitHub相信大家都见过类似下面这种徽章

![今日下载](https://img.shields.io/badge/dynamic/json?color=orange&label=%E4%BB%8A%E6%97%A5%E4%B8%8B%E8%BD%BD&query=%24.data.today_install&url=https%3A%2F%2Fscriptcat.org%2Fapi%2Fv2%2Fscripts%2F225&logo=data:image/svg+xml;base64,PHN2ZyB0PSIxNjUyMjc5MDM1Njc4IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjY4NTIiIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cGF0aCBkPSJNOTI4LjA1IDY4Ny43N1Y4NDcuN2MwIDEzLjMxLTQuNTcgMjQuNzUtMTMuOTEgMzQtOS4zNCA5LjM2LTIwLjY2IDEzLjkzLTMzLjk0IDEzLjkzSDE0NS42Yy0xMy4yOCAwLTI0LjctNC41OC0zMy45NC0xMy45My05LjM0LTkuMzYtMTMuOTEtMjAuNjktMTMuOTEtMzRWNjg3Ljc3YzAtMTMuMzEgNC41Ny0yNC43NSAxMy45MS0zNC4wMSA5LjM0LTkuMzYgMjAuNjYtMTMuOTMgMzMuOTQtMTMuOTNoMjMyLjA3bDY3LjM1IDY4YzE5LjMgMTguNzIgNDEuODMgMjcuOTggNjcuODggMjcuOTggMjYuMDUgMCA0OC41Ny05LjM2IDY3Ljg4LTI3Ljk4bDY3Ljg4LTY4aDIzMS42NWMxMy4yOSAwIDI0LjcgNC41NyAzMy45NCAxMy45MyA5LjAzIDkuNDcgMTMuOCAyMC44IDEzLjggMzQuMDF6TTc2NS45NCA0MDMuMzVjNS43MSAxMy42MiAzLjMzIDI1LjM3LTcuMDUgMzUuMDVMNTM1LjMzIDY2Mi4zOWMtNi4wMiA2LjM0LTEzLjM5IDkuNDYtMjIuNDIgOS40NnMtMTYuNS0zLjEyL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mZmZiI+PC9wYXRoPjwvc3ZnPg==)


今天逛GitHub的时候,发现[@万事可乐](https://bbs.tampermonkey.net.cn/?27321)哥哥的脚本项目给脚本用到了上面这种徽章,学习了一下制作方法,分享出来。

## shields.io
> 注意 国内可能无法访问,经常抽风

市面上大部分的徽章来源都是这里:(https://shields.io/),可以自定义图标、数据、颜色等等。我们脚本站的话主要就是使用这种动态的类型,通过脚本站的api去获取数据:
!(data/attachment/forum/202205/25/142856dr7vor2bt4um5o4u.png)

填好各种参数,然后生成,数据来源于脚本站的API:https://scriptcat.org/api/v2/scripts/$脚本id

请求格式为json,json路径为:$.data.today_install,当然除了今日下载还有总下载,更新等数据,可以单独请求接口去查看。如果需要其他数据的API也可以在本帖下方反馈。

还有其他的参数,比如logo、style等,可以在这个网站上探寻

![](https://img.shields.io/badge/dynamic/json?color=orange&label=%E4%BB%8A%E6%97%A5%E4%B8%8B%E8%BD%BD&query=%24.data.today_install&url=https%3A%2F%2Fscriptcat.org%2Fapi%2Fv2%2Fscripts%2F336&style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB0PSIxNjUyMjc5MDM1Njc4IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjY4NTIiIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cGF0aCBkPSJNOTI4LjA1IDY4Ny43N1Y4NDcuN2MwIDEzLjMxLTQuNTcgMjQuNzUtMTMuOTEgMzQtOS4zNCA5LjM2LTIwLjY2IDEzLjkzLTMzLjk0IDEzLjkzSDE0NS42Yy0xMy4yOCAwLTI0LjctNC41OC0zMy45NC0xMy45My05LjM0LTkuMzYtMTMuOTEtMjAuNjktMTMuOTEtMzRWNjg3Ljc3YzAtMTMuMzEgNC41Ny0yNC43NSAxMy45MS0zNC4wMSA5LjM0LTkuMzYgMjAuNjYtMTMuO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mi05LjQ2eiBtMTI3Ljc3IDBjNi4zMy02LjM0IDkuNDQtMTMuODMgOS40NC0yMi40NnMtMy4xMS0xNi4yMi05LjQ0LTIyLjQ2Yy02LjMzLTYuMjQtMTMuOC05LjQ3LTIyLjQyLTkuNDctOC42MSAwLTE2LjE5IDMuMTItMjIuNDIgOS40Ny02LjIzIDYuMzQtOS40NCAxMy44My05LjQ0IDIyLjQ2czMuMTEgMTYuMjIgOS40NCAyMi40NmM2LjMzIDYuMjQgMTMuNyA5LjQ2IDIyLjQyIDkuNDYgOC42MSAwLjExIDE2LjA4LTMuMTIgMjIuNDItOS40NnogbTAgMCIgcC1pZD0iNjg1MyIgZmlsbD0iI2ZmZmZmZiI+PC9wYXRoPjwvc3ZnPg==)

maxzhang 发表于 2022-5-25 15:08:37

一直都在用

gg居然没发现 伤心{:4_87:}

王一之 发表于 2022-5-25 15:12:50

maxzhang 发表于 2022-5-25 15:08
一直都在用

gg居然没发现 伤心

啊?哥哥的不是动态数据的吧

言小溪enncy 发表于 2022-5-25 15:16:54

马上安排

wwwwwllllk 发表于 2022-5-25 17:29:52

这个是干嘛的,我怎么没看懂

王一之 发表于 2022-5-25 17:51:31

wwwwwllllk 发表于 2022-5-25 17:29
这个是干嘛的,我怎么没看懂

装逼的,弄个徽章显示脚本的下载数之类

脚本体验师001 发表于 2022-5-26 11:31:43

给烟不给火,不如别给我
我要看只在外面蹭蹭,但从来不进去的有多少人
即打开了帖子(?=查看了代码)的次数,从而推导出受欢迎程度
请哥哥酌情支持

王一之 发表于 2022-5-26 11:35:27

脚本体验师001 发表于 2022-5-26 11:31
给烟不给火,不如别给我
我要看只在外面蹭蹭,但从来不进去的有多少人
即打开了帖子(?=查看了代码)的次数 ...

页面访问的次数,但是没有安装脚本的人吧?

这个的话,在下个版本准备在数据统计处理。

新增两个数据维度:访问PV与访客UV

对比安装量应该可以得出

脚本体验师001 发表于 2022-5-26 11:43:26

王一之 发表于 2022-5-26 11:35
页面访问的次数,但是没有安装脚本的人吧?

这个的话,在下个版本准备在数据统计处理。


就这个意思,哥哥明智
页: [1]
查看完整版本: 脚本数据徽章