所以我试图获取用户在Twitch上跟踪的频道列表
我正在使用urllib2从以下位置获取数据:
http://api.twitch.tv/kraken/users/user/follows/channels?offset=0&on_site=1
然而,我只想要用户遵循的频道列表,这里是原始json数据的样子,我只想要每个频道的显示名称,例如['Syndicate','Gem28daz2012',,我该怎么做
{
"follows": [{
"created_at": "2016-01-15T22:43:35Z",
"_links": {
"self": "https://api.twitch.tv/kraken/users/user/follows/channels/syndicate"
},
"notifications": false,
"channel": {
"_links": {
"self": "https://api.twitch.tv/kraken/channels/syndicate",
"follows": "https://api.twitch.tv/kraken/channels/syndicate/follows",
"commercial": "https://api.twitch.tv/kraken/channels/syndicate/commercial",
"stream_key": "https://api.twitch.tv/kraken/channels/syndicate/stream_key",
"chat": "https://api.twitch.tv/kraken/chat/syndicate",
"features": "https://api.twitch.tv/kraken/channels/syndicate/features",
"subscriptions": "https://api.twitch.tv/kraken/channels/syndicate/subscriptions",
"editors": "https://api.twitch.tv/kraken/channels/syndicate/editors",
"videos": "https://api.twitch.tv/kraken/channels/syndicate/videos",
"teams": "https://api.twitch.tv/kraken/channels/syndicate/teams"
},
"background": null,
"banner": null,
"broadcaster_language": "en",
"display_name": "Syndicate",
"game": "Counter-Strike: Global Offensive",
"logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/syndicate-profile_image-03bf1d6ad0025f86-300x300.png",
"mature": false,
"status": "Road To MLG! (CS:GO Competiive) ",
"partner": true,
"url": "http://www.twitch.tv/syndicate",
"video_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/syndicate-channel_offline_image-a15fc19d9828b9c7-640x360.png",
"_id": 16764225,
"name": "syndicate",
"created_at": "2010-10-17T23:19:43Z",
"updated_at": "2016-01-22T22:17:33Z",
"delay": null,
"followers": 2353424,
"profile_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/syndicate-profile_banner-5f912a83f7e9bafe-480.png",
"profile_banner_background_color": null,
"views": 38140282,
"language": "en"
}
}, {
"created_at": "2016-01-12T21:01:49Z",
"_links": {
"self": "https://api.twitch.tv/kraken/users/user/follows/channels/gem28daz2012"
},
"notifications": false,
"channel": {
"_links": {
"self": "http://api.twitch.tv/kraken/channels/gem28daz2012",
"follows": "http://api.twitch.tv/kraken/channels/gem28daz2012/follows",
"commercial": "http://api.twitch.tv/kraken/channels/gem28daz2012/commercial",
"stream_key": "http://api.twitch.tv/kraken/channels/gem28daz2012/stream_key",
"chat": "http://api.twitch.tv/kraken/chat/gem28daz2012",
"features": "http://api.twitch.tv/kraken/channels/gem28daz2012/features",
"subscriptions": "http://api.twitch.tv/kraken/channels/gem28daz2012/subscriptions",
"editors": "http://api.twitch.tv/kraken/channels/gem28daz2012/editors",
"videos": "http://api.twitch.tv/kraken/channels/gem28daz2012/videos",
"teams": "http://api.twitch.tv/kraken/channels/gem28daz2012/teams"
},
"background": null,
"banner": null,
"broadcaster_language": null,
"display_name": "Gem28daz2012",
"game": "Minecraft",
"logo": null,
"mature": null,
"status": "Playing minecraft",
"partner": false,
"url": "http://www.twitch.tv/gem28daz2012",
"video_banner": null,
"_id": 93338000,
"name": "gem28daz2012",
"created_at": "2015-06-12T19:51:58Z",
"updated_at": "2016-01-12T21:16:07Z",
"delay": null,
"followers": 8,
"profile_banner": null,
"profile_banner_background_color": null,
"views": 4,
"language": "en"
}
}],
"_total": 2,
"_links": {
"self": "https://api.twitch.tv/kraken/users/user/follows/channels?direction=DESC&limit=25&offset=0&sortby=created_at",
"next": "https://api.twitch.tv/kraken/users/user/follows/channels?direction=DESC&limit=25&offset=25&sortby=created_at"
}
要解析http响应体,可以使用^{} 。之后,您可以使用列表压缩:
从某种意义上说:
相关问题 更多 >
编程相关推荐