仅从抽搐队获得名字

时间:2019-01-04 10:20:11

标签: json curl twitch-api

我只想要彩带的名称并保存文件

我尝试过这种方式: curl -H'接受:application / vnd.twitchtv.v5 + json'-H'客户端ID:*********'-X GET'https://api.twitch.tv/kraken/teams/ ******** *'| python -c'导入json,sys; data = json.load(sys.stdin );打印数据[“ display_name”]'

但是它只得到队名,我想要所有的彩带名称。

这是仅带有curl的示例输出-H'接受:application / vnd.twitchtv.v5 + json'-H'客户ID:*********'-X GET'{{ 3}} *********'

[{"_id":372,"name":"asusrog","info":"From cooking and ASMR to high-level badassery in shooters, MOBAs, and fighters, ROG has built a family of the best individuals in Twitch entertainment. Set your expectations high as we present the Republic of Streamers.\u003cbr\u003e\u003cbr\u003e\r\n\r\nFor more details on streamers and ASUS Republic of Gamers, also visit \u003ca href=\"http://www.twitch.tv/asusrog\" rel=\"nofollow\" target=\"_blank\"\u003e twitch.tv/asusrog\u003c/a\u003e.","display_name":"ASUS Republic of Gamers","created_at":"2012-08-02T16:58:52Z","updated_at":"2017-06-06T23:01:31Z","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/team-asusrog-team_logo_image-5488df9aa2d7d8c8-600x600.jpeg","banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/team-asusrog-banner_image-35365f7af254d5bc-640x125.jpeg","background":"https://static-cdn.jtvnw.net/jtv_user_pictures/team-asusrog-background_image-eb11e267ce94d1fb.jpeg","users":[{"mature":false,"status":"Commit to the Champions Club | !prime | @DrDisrespect","broadcaster_language":"en","display_name":"DrDisrespect","game":"Just Chatting","language":"en","name":"drdisrespect","created_at":"2010-11-02T15:32:25Z","updated_at":"2019-01-04T10:04:20Z","_id":"17337557","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/710c3ca784e2941d-profile_image-300x300.jpeg","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/c04406645009fe4f-channel_offline_image-1920x1080.png","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/dc2ea1a9-fc6c-439a-adea-865e7f6ee8c6-profile_banner-480.png","profile_banner_background_color":null,"partner":true,"url":"https://www.twitch.tv/drdisrespect","views":107599475,"followers":3036245},{"mature":false,"status":"Searching For A Main Game  - Friday Next Stream, Subnautica? ","broadcaster_language":"en","display_name":"LIRIK","game":"Just Chatting","language":"en","name":"lirik","created_at":"2011-06-27T18:34:45Z","updated_at":"2019-01-04T10:01:37Z","_id":"23161357","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/7a75bd89-ecbf-4974-bc1f-6b967213595f-profile_image-300x300.png","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/67d1f66b-e9e9-4088-8a27-a3441a4e9228-channel_offline_image-1920x1080.jpeg","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/59c6867b-3782-42f4-b7f0-98035066c665-profile_banner-480.jpeg","profile_banner_background_color":"#221f1f","partner":true,"url":"https://www.twitch.tv/lirik","views":277513562,"followers":2323547},{"mature":true,"status":"RE-RUNS | 20 YEARS OF TRIVIUM! (EST 1999)","broadcaster_language":"en","display_name":"matthewkheafy","game":"Music \u0026 Performing Arts","language":"en","name":"matthewkheafy","created_at":"2017-03-27T15:05:59Z","updated_at":"2019-01-04T10:03:08Z","_id":"151637804","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/f55cb9d92cc9bfc6-profile_image-300x300.jpeg","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/c9b1eedba34e0d09-channel_offline_image-1920x1080.jpeg","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/08cfe37b-d36b-48fe-b58f-706e06c629d4-profile_banner-480.jpg","profile_banner_background_color":null,"partner":true,"url":"https://www.twitch.tv/matthewkheafy","views":1574843,"followers":89663},{"mature":false,"status":"Mortal Kombat 9 - PC - Finishing Up Story Mode \u0026 Blackout Later(1-3)","broadcaster_language":"en","display_name":"Maximilian_DOOD","game":"Call of Duty: Black Ops 4","language":"en","name":"maximilian_dood","created_at":"2012-04-28T03:03:56Z","updated_at":"2019-01-04T10:02:32Z","_id":"30104304","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/maximilian_dood-profile_image-c6e12e1798861491-300x300.png","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/068258ddc78769dc-channel_offline_image-1920x1080.png","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/75d1e477a99343db-profile_banner-480.png","profile_banner_background_color":"#000000","partner":true,"url":"https://www.twitch.tv/maximilian_dood","views":35752836,"followers":584571},{"mature":false,"status":"Plat 2 Solo Q ROAD TO DIAMOND | ADC only unless filled","broadcaster_language":"en","display_name":"xChocoBars","game":"League of Legends","language":"en","name":"xchocobars","created_at":"2013-04-18T02:59:24Z","updated_at":"2019-01-04T10:02:35Z","_id":"42583390","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/42bf357ccf3836ba-profile_image-300x300.jpeg","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/3b72f05c-0631-4364-a609-acc7eebe37bc-channel_offline_image-1920x1080.jpg","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/xchocobars-profile_banner-8f44935daecac8d9-480.jpeg","profile_banner_background_color":"#fff2ff","partner":true,"url":"https://www.twitch.tv/xchocobars","views":17430023,"followers":421476},{"mature":false,"status":"The MadPack 4 .:. World 36 .:. @MattDethridge on Socials | Canadian","broadcaster_language":"en","display_name":"Dethridge","game":"Minecraft","language":"en","name":"dethridge","created_at":"2012-11-08T17:57:41Z","updated_at":"2019-01-04T10:16:48Z","_id":"37530941","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/dethridge-profile_image-e8b5f163e2344211-300x300.png","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/715ce7f9-8dcd-4aec-9514-9a596f9a071b-channel_offline_image-1920x1080.png","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/4ef0c7ec-9214-4219-9bb9-04e0fe9a534e-profile_banner-480.png","profile_banner_background_color":"#000000","partner":true,"url":"https://www.twitch.tv/dethridge","views":10406670,"followers":278082},{"mature":true,"status":"(!prime) twitter.com/MrGrimmmmz - SOT \u0026 Chillin (Atlas / ??) ","broadcaster_language":"en","display_name":"Grimmmz","game":"Sea of Thieves","language":"en","name":"grimmmz","created_at":"2009-12-31T07:57:05Z","updated_at":"2019-01-04T10:15:42Z","_id":"9679595","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/grimmmz-profile_image-b6c4dd27a4b900a3-300x300.png","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/8f1a17ab41b96fae-channel_offline_image-1920x1080.png","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/grimmmz-profile_banner-55b81a98972257e1-480.jpeg","profile_banner_background_color":null,"partner":true,"url":"https://www.twitch.tv/grimmmz","views":38912663,"followers":909503},{"mature":true,"status":"DRINKING STREAM FOR NYE | !social | !mythicleague | #charity","broadcaster_language":"en","display_name":"fl0m","game":"Counter-Strike: Global Offensive","language":"en","name":"fl0m","created_at":"2011-09-26T19:14:19Z","updated_at":"2019-01-04T10:01:10Z","_id":"25093116","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/fl0m-profile_image-efa66f8f4aa42f40-300x300.png","video_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/6221bfed047cf6e4-channel_offline_image-1920x1080.png","profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/b8ff7d51e2c12ddf-profile_banner-480.png","profile_banner_background_color":"#030303","partner":true,"url":"https://www.twitch.tv/fl0m","views":30194382,"followers":425886},{"mature":false,"status":"Deviled Egg Challenge with my friend Brooke!! LETS GO!! (We all know I'm winning this)","broadcaster_language":"en","display_name":"Jae_Benny","game":"Food \u0026 Drink","language":"en","name":"jae_benny","created_at":"2015-03-24T20:19:51Z","updated_at":"2019-01-04T08:37:31Z","_id":"86177033","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/jae_benny-profile_image-790ad4b4822b5043-300x300.png","video_banner":null,"profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/jae_benny-profile_banner-868c75821ac7579c-480.jpeg","profile_banner_background_color":null,"partner":true,"url":"https://www.twitch.tv/jae_benny","views":454937,"followers":19908}]}]

感谢您的回复

1 个答案:

答案 0 :(得分:0)

该团队的彩带在列表中,键为“用户”。

请参阅API参考中的示例:https://dev.twitch.tv/docs/v5/reference/teams/

{
   "_id": 10,
   "name": "staff",
   "updated_at": "2014-10-16T00:44:11Z",
   "users": [{
         "_id": 5582097,
         "name": "sarbandia",
         ...
   },
   ...
   ]
}```


  [1]: https://dev.twitch.tv/docs/v5/reference/teams/