From 744f42a2ae7968881e4d8f1ce0ec0d5209c8d7a4 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Mon, 26 Jan 2026 13:27:28 -0500 Subject: Show releases --- cgithub/src/scraper.ts | 10 ++++++++++ cgithub/views/repo.eta | 3 +++ 2 files changed, 13 insertions(+) diff --git a/cgithub/src/scraper.ts b/cgithub/src/scraper.ts index c1bdef5..4ffdc43 100644 --- a/cgithub/src/scraper.ts +++ b/cgithub/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(/(\d+)<\/strong>\s*watching/); const forksMatch = html.match(/id="repo-network-counter"[^>]*>([^<]+)/); + let numReleases: number | undefined; + const releaseCountMatch = html.match( + /]*href="[^"]*\/releases"[^>]*>[\s\S]*?]*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, }; } diff --git a/cgithub/views/repo.eta b/cgithub/views/repo.eta index 4965e75..5bebb95 100644 --- a/cgithub/views/repo.eta +++ b/cgithub/views/repo.eta @@ -17,6 +17,9 @@ <% if (it.info.forks) { %> forks <%= it.info.forks %> <% } %> + <% if (it.info.numReleases) { %> +
<%= it.info.numReleases %> releases
+ <% } %> <% } %> -- cgit v1.3.1