diff options
| author | Joe Mou <dev@mou.fo> | 2026-08-27 15:02:13 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-08-27 15:02:20 -0400 |
| commit | 1f014a1f2a51cc9ced0349fe6353a6cc79303161 (patch) | |
| tree | 56edcb2956e67bda60e347e3e3a407c5ee024289 /cgithub/src/scraper.ts | |
| parent | 0d60b8c8235c3c07f675aba7a56dd37b62519f9e (diff) | |
Follow the commit history to its new home in the payload
GitHub moved commitGroups from the top of the embedded JSON into a
commitsRefRoute, alongside the code view's own routes, so every commits
page threw. The groups themselves are unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BErPR92xppzGFXkPqXPYj2
Diffstat (limited to 'cgithub/src/scraper.ts')
| -rw-r--r-- | cgithub/src/scraper.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cgithub/src/scraper.ts b/cgithub/src/scraper.ts index 1a67d05..c02cb5e 100644 --- a/cgithub/src/scraper.ts +++ b/cgithub/src/scraper.ts @@ -139,6 +139,10 @@ interface CodeViewBlobLayoutRouteStyledBlob { stylingDirectives: StylingDirective[][] | null; } +interface CommitsRefRoute { + commitGroups: CommitGroup[]; +} + interface CodeViewBlobRoute { richText: string | null; renderedFileInfo?: { renderFileType: string | null } | null; @@ -161,7 +165,7 @@ interface AppPayload { codeViewBlobLayoutRoute?: CodeViewBlobLayoutRoute; "codeViewBlobLayoutRoute.StyledBlob"?: CodeViewBlobLayoutRouteStyledBlob; codeViewBlobRoute?: CodeViewBlobRoute; - commitGroups?: CommitGroup[]; + commitsRefRoute?: CommitsRefRoute; // Actually there may be other query types. preloadedQueries?: IssueIndexPageQuery[]; } @@ -648,8 +652,9 @@ export async function getGitHubCommits( const html = await fetchGitHubPage(urlPath); const payload = parsePayload(html); + const commitsRoute = payload?.commitsRefRoute; - if (payload?.commitGroups === undefined) { + if (commitsRoute === undefined) { throw new Error("Could not find commit history in embedded JSON"); } @@ -660,7 +665,7 @@ export async function getGitHubCommits( }, branch, path, - commitGroups: payload.commitGroups, + commitGroups: commitsRoute.commitGroups, }; } |
