问题描述
我正在尝试从 github gist API 获取文件名,下面是我在调用 gist api 时得到的输出。但问题是我如何从输出中获取文件名。因为文件名在文件下,我想显示文件名。那我该怎么做。我是 API 新手,所以只能显示 url、id 等。
{
"url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2","forks_url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2/forks","commits_url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2/commits","id": "41da54b03986886e1a4e57c8cdb38dc2","node_id": "MDQ6R2lzdDQxZGE1NGIwMzk4Njg4NmUxYTRlNTdjOGNkYjM4ZGMy","git_pull_url": "https://gist.github.com/41da54b03986886e1a4e57c8cdb38dc2.git","git_push_url": "https://gist.github.com/41da54b03986886e1a4e57c8cdb38dc2.git","html_url": "https://gist.github.com/41da54b03986886e1a4e57c8cdb38dc2","files": {
"telegram-white.svg": {
"filename": "telegram-white.svg","type": "image/svg+xml","language": "SVG","raw_url": "https://gist.githubusercontent.com/cmschandan/41da54b03986886e1a4e57c8cdb38dc2/raw/16b1aac41526997d87400f33ad9912d511faf7a4/telegram-white.svg","size": 1266
}
},"public": true,"created_at": "2020-12-11T12:58:59Z","updated_at": "2020-12-11T12:59:46Z","description": "","comments": 0,"user": null,"comments_url": "https://api.github.com/gists/41da54b03986886e1a4e57c8cdb38dc2/comments","owner": {
"login": "cmschandan","id": 21227329,"node_id": "MDQ6VXNlcjIxMjI3MzI5","avatar_url": "https://avatars.githubusercontent.com/u/21227329?v=4","gravatar_id": "","url": "https://api.github.com/users/cmschandan","html_url": "https://github.com/cmschandan","followers_url": "https://api.github.com/users/cmschandan/followers","following_url": "https://api.github.com/users/cmschandan/following{/other_user}","gists_url": "https://api.github.com/users/cmschandan/gists{/gist_id}","starred_url": "https://api.github.com/users/cmschandan/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/cmschandan/subscriptions","organizations_url": "https://api.github.com/users/cmschandan/orgs","repos_url": "https://api.github.com/users/cmschandan/repos","events_url": "https://api.github.com/users/cmschandan/events{/privacy}","received_events_url": "https://api.github.com/users/cmschandan/received_events","type": "User","site_admin": false
},"truncated": false
},
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)