Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get specific README.md data from Github API

Recently, I started experimenting with the GitHub API getting specific data from public repos. Long story short, I want to grab specific parts of the README.md file from a repo.

For example, the master branch from Facebook's react repository I want to grab the text under the Documentation header the GitHub API. Is this possible? Any methods of achieving this are welcome. Thank you!

API : React README.md API Data

Public Github URL: React public repo

like image 697
Cody Avatar asked Oct 28 '25 13:10

Cody


2 Answers

There is no way to do this with the API, but one easy way is with sed; try this from a Linux command line:

curl https://raw.githubusercontent.com/facebook/react/master/README.md | \
    sed -n '/## Documentation/,/##/p'

This will return everything between the Documentation header and the next one.

like image 195
Ken Y-N Avatar answered Oct 30 '25 10:10

Ken Y-N


There is a very awesome way to use any GitHub repository MARKDOWN.md file with the use of API.

https://raw.githubusercontent.com/{owner}/{repo}/{branch}/README.md

the above API returns everything in your README.md file in raw MarkDown format. api-use-picture

like image 32
Suryapratap Singh Avatar answered Oct 30 '25 10:10

Suryapratap Singh