Get specific README.md data from Github API

回眸只為那壹抹淺笑 提交于 2019-12-24 19:29:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!