This document describe ways to workaround GitHub API, especially the rate limit.
Let's say you would like to extract files from this commit. The organization name is INRIA
, the project name is spoon
and the commit SHA is 4ee28da1dcdb39d34edc32cd8bbc2b1d2bf0183b
. In this commit, three files were changed:
src/main/java/spoon/reflect/factory/TypeFactory.java
src/test/java/spoon/test/prettyprinter/SniperDoubleBoundTest.java
src/test/java/spoon/test/prettyprinter/testclasses/DoubleBound.java
To get src/main/java/spoon/reflect/factory/TypeFactory.java
from INRIA/spoon
with commit SHA ID 4ee28da1dcdb39d34edc32cd8bbc2b1d2bf0183b
, we can use the following GitHub API call:
curl https://raw.githubusercontent.com/INRIA/spoon/4ee28da1dcdb39d34edc32cd8bbc2b1d2bf0183b/src/main/java/spoon/reflect/factory/TypeFactory.java
But currently, the GitHub API rate limit is 5000 requests per hour with OAuth.
I will use jsDelivr as an example of GitHub mirror.
To get src/main/java/spoon/reflect/factory/TypeFactory.java
from INRIA/spoon
with commit SHA ID 4ee28da1dcdb39d34edc32cd8bbc2b1d2bf0183b
, we can use the following jsDelivr API call:
curl https://cdn.jsdelivr.net/gh/INRIA/spoon@4ee28da1dcdb39d34edc32cd8bbc2b1d2bf0183b/src/main/java/spoon/reflect/factory/TypeFactory.java
This can be easily parallelized and exceed 5000 requests per hour.