star-history / star-history

The missing star history graph of GitHub repos - https://star-history.com

Home Page:https://star-history.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error regex when get total page count

bytemain opened this issue · comments

https://github.com/bytebase/star-history/blob/master/src/helpers/api.ts#L93

headers' link example:

const link = `<https://api.github.com/repositories/xxx/stargazers?per_page=30&page=2>; rel="next", <https://api.github.com/repositories/xxx/stargazers?per_page=30&page=7>; rel="last"`;
const regResult = /next.*?page=(\d*).*?last/.exec(link);
console.log(regResult);

image

the regResult will always 30...

so it's better change the regex:

- /next.*?page=(\d*).*?last/
+ /next.*page=(\d*).*?last/