GitHub Scraper or API: What You Get
A GitHub scraper is code that loads repository, commit, issue and trending pages and reads stars, files, commit lists and release names out of the HTML. You maintain the fetching, the parsing and the paging. The alternative is 32 GitHub endpoints that return the same kinds of data as JSON for 1 credit a successful call, from one repository's metadata to a compare between two refs. This post compares the two routes on endpoints, parameters, cost per repository tracked and upkeep, and gives a verdict per use case.
What does building a GitHub scraper involve?
Building a GitHub scraper means writing a fetcher, a set of parsers and a pager, then keeping them in step with pages you don't control. Each kind of page needs its own parser: a repository's front page, its commit list, its issues, its releases, a file view, a user's page and the trending list all lay out their data differently. A tracker that watches a few hundred repositories touches most of them every run.
The parsers are where the upkeep goes. Code hosting sites ship interface changes regularly, and a selector that found the star count last month can find nothing today. Parts of a modern page are often loaded by scripts after the first response, so the data you want may need a headless browser or a replay of the page's own requests. Either way, a broken parser usually returns empty values rather than an error.
Volume is the second problem. One script reading ten pages behaves nothing like a scheduled job reading thousands, and large sites have to tell people apart from automated traffic. Expect slow responses, errors and challenge pages as you scale, and when they appear, stop rather than work around them with rotating proxies. Read GitHub's terms of use before you build a collector, and if the site offers its own developer access that fits your job, compare it on your own terms and limits too.
What else does a recurring scraper need?
A scheduled scraper needs paging, storage and monitoring on top of parsing. Paging means walking commit, issue and release lists without missing items when new ones arrive mid-run. Storage means deciding what you keep per run and for how long. Monitoring compares each run with the last and alerts when a repository that had hundreds of commits suddenly reports none. YouTube Scraper or API covers the same trade-off for a video source.
What do the GitHub endpoints cover?
The GitHub API has 32 endpoints, all GET, all 1 credit per successful call. They fall into four groups: one repository's data, comparisons between two refs, discovery through search and trending, and users. Each returns JSON collected from publicly available sources, as found at the time of the call. There's no recorded response for this API yet, so this post lists endpoints and parameters but not response fields; run a call in the playground on the API page to see the shape.
Which endpoints read one repository?
Nineteen endpoints take owner and repo. These are the ones a repository tracker uses:
| Endpoint | Returns | Other required | Optional |
|---|---|---|---|
/v1/github/repository |
Repository | none | none |
/v1/github/repository-activity |
Repository Activity | none | none |
/v1/github/repository-commits |
Repository Commits | none | page, per_page, sha, path, author, since, until |
/v1/github/repository-issues |
Repository Issues | none | page, per_page, state (open, closed, all), sort (created, updated, comments), direction, labels, since |
/v1/github/repository-issues-comments |
Repository Issues Comments | number |
page, per_page |
/v1/github/repository-pulls |
Repository Pulls | number |
none |
/v1/github/repository-releases |
Repository Releases | none | page, per_page |
/v1/github/repository-tags |
Repository Tags | none | page, per_page |
/v1/github/repository-branches |
Repository Branches | none | page, per_page |
/v1/github/repository-contributors |
Repository Contributors | none | page, per_page, anon |
/v1/github/repository-languages |
Repository Languages | none | none |
/v1/github/repository-readme |
Repository Readme | none | ref |
/v1/github/repository-tree |
Repository Tree | none | ref, recursive |
/v1/github/repository-files |
Repository Files | none | path, ref |
/v1/github/repository-files-at-ref |
Repository Files At Ref | ref |
none |
/v1/github/repository-raw-file |
Repository Raw File | path, ref |
none |
The other three take base and head as well: /v1/github/repository-compare-commits, /v1/github/repository-compare-files and /v1/github/repository-compare-patch. A scraper would need a separate parser for each of these views; here each is one call.
Which endpoints find repositories?
Two discovery endpoints need no repository name. /v1/github/search-repositories takes a required q (up to 256 characters) plus sort (stars, forks, help-wanted-issues, updated), order (asc, desc), page and per_page. /v1/github/trending-repositories takes optional language, since (daily, weekly, monthly) and spoken_language_code. No defaults or page sizes are documented, so set per_page yourself where you depend on it.
curl "https://api.perceptlayer.com/v1/github/search-repositories?q=web+scraping&sort=stars&order=desc" \
-H "X-API-Key: $API_KEY"
The key goes in the X-API-Key header, as the authentication docs describe. Whether a search result's fields match the owner and repo the other endpoints take isn't recorded here, so check that in the playground before you chain them.
What about user endpoints?
Ten endpoints take a username: user, user-activity, user-contributions, user-counts, user-events, user-followers, user-following, user-repositories, user-starred and user-tabs, plus trending-developers. They return data about people, so use them with care. Keep work at the level of projects and organisations, don't build profiles of individuals, and don't use the data to contact anyone.
How do a scraper and the endpoints compare?
A scraper costs engineering time and carries blocking and terms risk; the endpoints cost 1 credit per call and leave you no parser to maintain. The table compares them for a recurring job, such as watching a list of repositories for new releases, commits and issues each day.
| DIY GitHub scraper | GitHub endpoints | |
|---|---|---|
| Setup | Fetcher, one parser per page type, pager, storage, monitoring | API key in the X-API-Key header |
| Inputs | Page URLs you build | owner, repo, q, username, ref, base, head and the optional filters above |
| Output | Whatever you can parse from each page | JSON per endpoint; check the shape in the playground |
| When pages change | Your parsers return empty values until you fix them | You read JSON; there's no parser of yours to fix |
| Blocks and challenges | Yours to handle, more likely at volume | Not yours to handle; a failed call returns an error code and costs 0 |
| Paging | You find and follow the page links | page and per_page on list endpoints |
| Speed | As fast as you can fetch without being blocked | 1 request a second free, at least 5 a second paid |
| Cost | Hosting and your time | 1 credit per successful call |
What does a repository cost to track?
Cost follows calls, and every GitHub endpoint is 1 credit. A daily snapshot of one repository with repository, repository-releases and repository-issues (with state=open and sort=updated) is 3 calls × 1 credit = 3 credits per repository per day. For 100 repositories that's 300 credits a day, or 9,000 credits over 30 days, inside the Starter pack's 10,000.
The 100 free credits granted once on signup cover a single repository call for each of 100 repositories, which is enough to test the fields against your list. A weekly trending watch, one trending-repositories call with since=weekly for each of 10 languages, is 10 credits a week, or 520 credits a year. See pricing for what credits cost and the credits docs for how they're debited.
How fast can a daily run go?
Limits are per account and counted per minute. A free account gets 1 request a second, so 300 calls take five minutes. Paying accounts run at least 5 requests a second, which brings the same run to one minute. A rate-limited call returns 429 with a Retry-After header. The rate limits docs list the rate each pack includes.
Which route should you choose?
Choose by how many repositories you watch, how often, and which views you need, because that decides whether parser upkeep or per-call credits dominate. For a quick look at a handful of repositories, a browser or a git clone is enough and you need neither. The verdicts below assume recurring work.
- Tracking releases and activity on a list of dependencies: call
repository-releasesandrepositorydaily per repository and store the run date. 2 credits per repository per day. - Finding projects in a space:
search-repositorieswith aqandsort=stars, then the repository endpoints on what you keep. 1 credit per search page. - Watching what's trending by language:
trending-repositorieswithlanguageandsince. 1 credit per call. - Reviewing what changed between two versions:
repository-compare-commits,-filesor-patchwithbaseandhead, instead of diffing pages. - Reading code at scale: if you need whole repositories, cloning is simpler than any page-by-page approach. Use
repository-raw-fileorrepository-treefor single files and listings. - An agent answering questions about open-source projects: give it the GitHub endpoints through the MCP server, as the AI agents docs describe. The
call_endpointtool spends credits on success only.
The apps and media APIs page lists related sources. To see the response shape for your own repositories, run repository in the playground on the GitHub API page, then get a free API key when it fits.
APIs in this post
Frequently asked questions
Is scraping GitHub allowed?
That depends on GitHub's terms of use, how you collect the data and the law where you operate, so read the terms and get legal advice for commercial projects. Don't get around blocks or challenges. Repository metadata is lower risk than data about people; if you use the user endpoints, don't build profiles of individuals and don't use the data to contact anyone.
How much does a GitHub call cost?
Every one of the 32 GitHub endpoints costs 1 credit per successful call, and failed calls cost nothing. Snapshotting 100 repositories with 3 calls each is 300 credits a day. The 100 free credits on signup are granted once; recurring work needs a pack, starting with the Starter pack's 10,000 credits, which last 12 months.
Can I page through commits and issues?
Yes. repository-commits, repository-issues, repository-releases, repository-tags, repository-branches and repository-contributors all take optional page and per_page integers. No defaults or page sizes are documented, so set per_page yourself and read each response before you request the next page. Each page is one call at 1 credit.
Can I get a file's contents without cloning?
Yes. /v1/github/repository-raw-file takes owner, repo, path and ref, all required, and /v1/github/repository-readme takes owner and repo with an optional ref. For a listing of files, use repository-tree with optional ref and recursive. Each call costs 1 credit. For whole repositories, cloning is simpler.
What does a failed GitHub call return?
An HTTP status and a JSON body with an error object holding a code, a message and a request_id, plus X-Credits-Used: 0. Codes include not_found (404), invalid_parameters (422) for an out-of-range value, and rate_limited (429), which carries a Retry-After header with the seconds to wait. The errors docs list every code.