• Stars
    star
    813
  • Rank 55,714 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

( `д′) how many followers do i have? how many!
substats

substats

Get started · What's new? · Sponsoring

( `д′) how many followers do i have? how many!

Cloudflare Workers Version 2.0/substats Vercel

Get started

sub · stats /səb ˈ stats/

  • a serverless api for getting the number of followers of you in your favourite services

*Version 2.0 is still in beta, not all features are ported from 1.0. Check below for details 👇

Basic

https://api.swo.moe

You request:

GET /stats/:source/:key

I respond:

{
  source: string,
  key: string,
  failed: true | false,
  count: number | string  // Most often it's a number when source !== 'common'
}

Yep, it's that simple now. ;)

*Note that key needs to be url encoded, remember this if you are requesting the feedly, inoreader, or feedspub routes.

Building badges 🎫

Of course! And as a matter of fact, substats works quite well with shields.io's /dynamic route. All these badges below are dynamically generated with substat's data:

GitHub Telegram 微博 少数派 爱发电 即刻 Steam 知乎 哔哩哔哩 掘金 语雀

You can easily create your own badge with our badge builder at substats.swo.moe.

Badge builder screenshot

Advanced - the /common route 🍀

What if the source you are trying to use is not supported yet, but it's just a simple GET request? In this case, you can use the route:

GET /stats/common?endpoint=<url>&datapath=<path>

Such as:

GET /stats/common/?endpoint=https://api.genshin.dev/domains/cecilia-garden&datapath=rewards.0.details.2.mora

In this case, the endpoint is an API url:

https://api.genshin.dev/domains/cecilia-garden

The response this URL returns looks like:

{
  "name": "Cecilia Garden",
  "type": "Forgery",
  // ...
  "rewards": [
    {
      "details": [
        { /* ... */ },
        { /* ... */ },
        {
          "mora": 1125,
        },
      ]
    }
  ]
}

Hence, we provide the datapath as rewards.0.details.2.mora. (I specifically chose this data as it contains an array to demonstrate how to reference the value mora inside the array by index.)

Response from the endpoint provided by you is parsed with object-path, and the method for constructing a reference datapath to your value in the response is the same.

Try our /common route API URL builder here: substats.swo.moe/common.

Common route screenshot

Supported sources

  • afdian
  • bilibili
  • coolapk
  • feedly
  • feedspub
  • github
  • inoreader
  • instagram
  • jike
  • mastodon
  • medium
  • neteasemusic
  • reddit
  • sspai
  • steamgames
  • steamfriends
  • telegram
  • twitter
  • unsplash
  • weibo
  • wikipediazh
  • zhihu
  • juejin
  • yuque

logo_afdian logo_bilibili logo_coolapk logo_feedly logo_feedspub logo_github logo_inoreader logo_ins logo_jike logo_mastodon logo_medium logo_neteasemusic logo_reddit logo_sspai logo_steam logo_tg logo_twitter logo_unsplash logo_weibo logo_wikipedia logo_zhihu logo_juejin logo_yuque

What's new?

Yes, substats is now version v2.0-beta! Most of the updates are under-the-hood apart from API formats.

  • Refactored in TypeScript.
  • Updated to CloudFlare's module workers.
  • Worker is built with esbuild instead of webpack, extra fast!
  • Support for Newsblur has been deprecated (seems nobody uses it).
  • KV storages are now supported, some routes including instagram and inoreader depends on this for storing cookies (wip).
  • Caching is ported to module workers in 2.0 and supported as always.
  • New documentation and query builder.

If you are looking for the multiple source and query functions in 2.0 - it's still under refactor, as itty-router does not parse multiple query parameters, blocking this feature here. You can still use the 1.0 route while we wait. README and documentation for v1.0 (deprecated).

Contributing

This is a monorepo managed by pnpm. Directory ./worker holds the Cloudflare Worker module, and ./docs is a React site for documentation (powered by Vite and Chakra UI). Check the README.md for both packages for details.

Sponsoring

Open-source is hard! If you happen to like this project and want me to keep going, please consider sponsoring me or providing a single donation! Thanks for all the love and support!

🧸 Please donate - 微信/支付宝 · Patreon · 爱发电

License

MIT

made with ❤️ by spencer woo

More Repositories

1

onedrive-vercel-index

OneDrive public directory listing, powered by Vercel and Next.js
TypeScript
3,019
star
2

onedrive-cf-index

Deprecated, use new project 👇
JavaScript
1,078
star
3

dowww

📟 Dev on Windows with WSL | 在 Windows 上用 WSL 优雅开发
925
star
4

dotfiles-archive

Dotfiles for all :D
Shell
761
star
5

BITCS-Coursework

不完整北京理工大学计算机学院课程项目资料清单。
184
star
6

PaimonMenuBar

Track real-time Genshin Impact stats in your macOS menubar
Swift
162
star
7

firefox-overlay-scrollbar

A working prototype of custom styleable overlay scrollbars on Firefox 72+.
JavaScript
119
star
8

react-notion-blog

Deprecated - original blog see other branch
TypeScript
95
star
9

portfolio

🍌 My personal portfolio / homepage / showcase
Vue
86
star
10

bit-webvpn-converter

Web VPN converter.
TypeScript
84
star
11

build-your-pc-docs

辛苦三星期,造台计算机!
65
star
12

foam-wiki

Foam as second brain. Powered by VuePress.
CSS
55
star
13

jsbox-sspai-namecard

少数派作者名片 | 一个 JSBox 小组件
JavaScript
37
star
14

bannero

An image API for simpledesktops.com
Python
34
star
15

vscode-sspai-markdown-helper

VS Code Markdown Helper for sspai.com
CSS
29
star
16

jsbox-vultr-helper

一款运行在 JSBox (iOS) 上的 Vultr 服务器账户查询小工具
JavaScript
28
star
17

mihoro

Mihomo CLI client on Linux. Formerly `clashrup`.
Rust
25
star
18

cwim

cwim - Count number of words in a markdown file / markdown files. CJK friendly.
Rust
24
star
19

single-cycle-processor

An implementation of the simplest single cycle processor.
VHDL
24
star
20

ga-hit-count-serverless

🍐 Google Analytics hit count API for static websites. Deployed on Vercel.
TypeScript
23
star
21

bitsrun-rs

🌐 A headless login / logout CLI for 10.0.0.55 at BIT, now in Rust. 北京理工大学 10.0.0.55 校园网登录登出的 Rust 实现
Rust
22
star
22

blog

👨‍💻 Spencer Woo - Spencer's blog
Vue
22
star
23

jike-guoguo-badge

A custom Jike name badge.
Vue
22
star
24

onedrive-vercel-index-docs

📘 Documentation for onedrive-vercel-index
JavaScript
20
star
25

exp3-producer-consumer

【操作系统课程设计】实验三、生产者消费者问题
C++
18
star
26

notion-page-sort

Sort through Notion's sub-page by title (or part of its title).
Python
15
star
27

spencerwoo.com

Spencer's Blog
TypeScript
13
star
28

syntactic-analysis

【编译原理】语法分析实验
Python
11
star
29

zan-chat

A peer-to-peer communication system. BIT 小学期软件开发实训。
C
11
star
30

SokobanGame

A Sokoban Game implemented with WPF, and Assembly in its core.
C#
11
star
31

spencerwooo

10
star
32

jike-meow

3rd Party Jike app Firefox & Microsoft Edge extension built with Vue.
JavaScript
9
star
33

lab-exercise

7 small lab exercises of BIT network experiment.
Java
8
star
34

apple-product-guide

Apple Product Guide API. Data acquired from: Buyer's Guide by MacRumors.
Go
8
star
35

bank-simulation-client

【操作系统课程设计】一个基于 Electron 的银行模拟器客户端
JavaScript
8
star
36

Sudoku

🍳 数独 | BIT 软件工程个人作业
Python
7
star
37

torch-featurelayer

🧠 Useful utility functions and wrappers for hooking onto layers within PyTorch models for feature extraction.
Python
7
star
38

jike-guoguo-backend

Backend API for Jike GuoGuo Badge
JavaScript
6
star
39

cartoonize-images

Cartoonize image with MATLAB.
MATLAB
5
star
40

fluffy-math

🔣 四则运算 | BIT 软件工程
JavaScript
5
star
41

spencerwooo.github.io

Blog archive.
5
star
42

icp-dummy-page

Dummy ICP page for censorship.
Vue
5
star
43

WeatherMeow

A simple weather app, to pay tribute to App Store UI Designs.
Java
4
star
44

DSAIS-Lab-Beamer-Template

✒ Data Security and Artificial Intelligence Security Laboratory LaTeX Beamer Template
TeX
4
star
45

vuepress-markdown-it-wikilink

Wikimedia-style links for VuePress using the markdown-it parser
JavaScript
3
star
46

foam-template

🔬 Foam as a second brain. For demo purposes, see https://foambubble.github.io/foam/katex-math-rendering.
HTML
3
star
47

CN-Data-Link-Layer

[Computer Networks] The Data Link Layer Experiment
Java
3
star
48

fluffy-math-docs

🔣 四则运算 | BIT 软件工程项目文档
2
star
49

spencerwoo.com.archive

Astro
2
star
50

advsteg-pytorch

A PyTorch implementation of the NeurIPS 2017 paper: Generating Steganographic Images via Adversarial Training
Jupyter Notebook
2
star
51

situational-awareness-vr

UofG MSc Project - Instrumenting, quantifying, and visualising attention and actions in VR
Jupyter Notebook
2
star
52

lexical-analysis

【编译原理】词法分析实验
Java
2
star
53

giscus-discussions

1
star
54

compilers-lang-recognization

程序设计语言认知实验项目仓库
C++
1
star
55

fluffy-math-spa

🌟 Web frontend for fluffy math
Vue
1
star
56

F00L

📦 F00L: Investigating the Robustness of Adversarial Examples
Jupyter Notebook
1
star
57

exp4-memory-monitor

【操作系统课程设计】实验四、内存监视
C++
1
star
58

CN-Packet-Sniffer

[Computer Networks] The Packet Sniffing Experiment
Java
1
star