public CurrentLiveInfoViewModel(CommunityLiveInfo liveInfo, HohoemaPlaylist playlist) { HohoemaPlaylist = playlist; LiveTitle = liveInfo.LiveTitle; LiveId = liveInfo.LiveId; }
public CurrentLiveInfoViewModel(CommunityLiveInfo liveInfo, CommunityDetail community) { LiveTitle = liveInfo.LiveTitle; LiveId = liveInfo.LiveId; ProviderId = community.Id; ProviderName = community.Name; }
public static async Task <CommunityLiveInfo[]> GetCommunityLives(IDataSource server, CookieContainer cc, string communityId) { //以下のAPIだとON_AIRだけ取れる。 //https://com.nicovideo.jp/api/v1/communities/{communityIdWithoutCo}/lives/onair.json //でも配信していないと //{"meta":{"status":404,"error-code":"RESOURCE_NOT_FOUND","error-message":"このコミュニティは生放送中ではありません。"}} //が返ってくる var communityIdWithoutCo = communityId.Substring(2); var url = $"https://com.nicovideo.jp/api/v1/communities/{communityIdWithoutCo}/lives.json"; var res = await server.GetAsync(url, cc); dynamic d = JsonConvert.DeserializeObject(res); if (d.meta.status != 200) { throw new ApiGetCommunityLivesException(); } var lives = new List <CommunityLiveInfo>(); foreach (var liveDyn in d.data.lives) { var live = new CommunityLiveInfo { Description = (string)liveDyn.description, LiveId = (string)liveDyn.id, Status = (string)liveDyn.status, Title = (string)liveDyn.title, UserId = (long)liveDyn.user_id, WatchUrl = (string)liveDyn.watch_url, }; lives.Add(live); } return(lives.ToArray()); }