summaryrefslogtreecommitdiff
path: root/cgithub/src
diff options
context:
space:
mode:
Diffstat (limited to 'cgithub/src')
-rw-r--r--cgithub/src/scraper.ts11
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,
};
}