public VimeoChannelsResponse GetUserChannels(string name) { HttpWebResponse response = SocialUtils.DoHttpGetRequest("http://vimeo.com/api/v2/" + name + "/channels.xml"); if (response.StatusCode == HttpStatusCode.OK) { return(VimeoChannelsResponse.Parse(XElement.Parse(response.GetAsString()))); } throw new VimeoException(response.GetAsString()); }
public VimeoChannel GetChannelInfo(string name) { HttpWebResponse response = SocialUtils.DoHttpGetRequest("http://vimeo.com/api/v2/channel/" + name + "/info.xml"); if (response.StatusCode == HttpStatusCode.OK) { return(VimeoChannel.ParseMultiple(XElement.Parse(response.GetAsString())).FirstOrDefault()); } throw new VimeoException(response.GetAsString()); }
/// <summary> /// Get a list of channel videos. /// </summary> /// <param name="id">The ID of the channel.</param> /// <param name="page">The Simple API only allows to browse pages 1 through 3.</param> public VimeoChannelVideosResponse GetChannelVideos(string id, int page) { NameValueCollection query = new NameValueCollection(); if (page > 0) { query.Set("page", page + ""); } HttpWebResponse response = SocialUtils.DoHttpGetRequest("http://vimeo.com/api/v2/channel/" + id + "/videos.json", query); if (response.StatusCode == HttpStatusCode.OK) { return(VimeoChannelVideosResponse.Parse(JsonConverter.ParseArray(response.GetAsString()))); } string str = response.GetAsString(); Match match = Regex.Match(str, "<section id=\"exception_msg\" class=\"block\">(.+?)</section>", RegexOptions.Singleline); throw new VimeoException(match.Success ? match.Groups[1].Value.Trim() : str); }