aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-01-26 13:27:28 -0500
committerJoe Mou <dev@mou.fo>2026-01-26 17:23:43 -0500
commita0927f2ccdfe65a89eb65006e1fb3b95ca0c52dd (patch)
treeb19a03d2e9b73a286b068bd249a4588bae9c2851 /src
parent967fb03d4014f862353cb110eefbede78304045c (diff)
Show releases
Diffstat (limited to 'src')
-rw-r--r--src/scraper.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/scraper.ts b/src/scraper.ts
index c1bdef5..4ffdc43 100644
--- a/src/scraper.ts
+++ b/src/scraper.ts
@@ -54,6 +54,7 @@ export interface RepoInfo {
stars: string | null;
watchers: string | null;
forks: string | null;
+ numReleases?: number;
}
export interface GitHubRepo extends GitHubTree {
@@ -110,12 +111,21 @@ function parseRepoInfo(html: string): RepoInfo {
const watchersMatch = html.match(/<strong>(\d+)<\/strong>\s*watching/);
const forksMatch = html.match(/id="repo-network-counter"[^>]*>([^<]+)/);
+ let numReleases: number | undefined;
+ const releaseCountMatch = html.match(
+ /<a[^>]*href="[^"]*\/releases"[^>]*>[\s\S]*?<span[^>]*title="(\d+)"[^>]*(?:class="[^"]*Counter|data-view-component="true")[^>]*>/,
+ );
+ if (releaseCountMatch) {
+ numReleases = parseInt(releaseCountMatch[1], 10);
+ }
+
return {
description,
website: websiteMatch?.[1] || null,
stars: starsMatch?.[1]?.trim() || null,
watchers: watchersMatch?.[1] || null,
forks: forksMatch?.[1]?.trim() || null,
+ numReleases,
};
}