stackoverflow-card icon indicating copy to clipboard operation
stackoverflow-card copied to clipboard

Add support for `site` parameter to fetch stats from different StackExchange sites

Open QueenDekim opened this issue 4 months ago • 2 comments

This PR introduces support for a new query parameter site, allowing the service to fetch user statistics from any StackExchange site instead of being limited to StackOverflow.

  • New site query parameter (defaults to stackoverflow if not provided).
  • Handles .com suffix by stripping it automatically.
  • Updated API request to api.stackexchange.com to use the chosen site.
  • Updated rank URL generation to point to the correct site domain.

Why: Previously, the service only supported StackOverflow. With this change, it becomes more flexible and can be used for other StackExchange communities.

Testing:

  • Call with ?userID=<id> → defaults to StackOverflow.
  • Call with ?userID=<id>&site=superuser → fetches from SuperUser.
  • Call with ?userID=<id>&site=askubuntu.com.com suffix is stripped and handled correctly.

QueenDekim avatar Sep 10 '25 13:09 QueenDekim

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
stackoverflow-card Ready Ready Preview Comment Sep 10, 2025 6:16pm

vercel[bot] avatar Sep 10 '25 13:09 vercel[bot]

don't pay attention to the commits after closing (and before reopening the PR), there I just made the repository for myself

QueenDekim avatar Sep 10 '25 14:09 QueenDekim