问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/53605718/get-specific-readme-md-data-from-github-api