public async Task <OEmbed> GetOEmbed(string service, string url) { OEmbed result = new OEmbed(); string oEmbedUrl = string.Empty; if (service == "youtube") { oEmbedUrl = "https://youtube.com/oembed?url=" + url; } if (!string.IsNullOrEmpty(oEmbedUrl)) { var request = new HttpRequestMessage(HttpMethod.Get, oEmbedUrl); var client = _clientFactory.CreateClient(); var response = await client.SendAsync(request); if (response.IsSuccessStatusCode) { result.Response = await response.Content.ReadAsStringAsync(); } } return(result); }
public void CanEmbedForHatenaBlog() { var oembed = new OEmbed(); var canEmbed = oembed.CanEmbed("http://staff.hatenablog.com/entry/2014/09/03/153938"); Assert.IsTrue(canEmbed); }
public async Task EmbedAsyncForHatenaBlog() { var oembed = new OEmbed(); var actual = await oembed.EmbedAsync("http://staff.hatenablog.com/entry/2014/09/03/153938"); Assert.IsNotNull(actual); }
public void CanEmbedForSlideShare() { var oembed = new OEmbed(); var canEmbed = oembed.CanEmbed("http://www.slideshare.net/shibayan/knockout-11523371"); Assert.IsTrue(canEmbed); }
public async Task EmbedAsyncForSlideShare() { var oembed = new OEmbed(); var actual = await oembed.EmbedAsync("http://www.slideshare.net/shibayan/knockout-11523371"); Assert.IsNotNull(actual); }
public async Task EmbedAsyncForFlickr() { var oembed = new OEmbed(); var actual = await oembed.EmbedAsync("http://www.flickr.com/photos/gsfc/6760135001/"); Assert.IsNotNull(actual); }
public void CanEmbedForFlickr() { var oembed = new OEmbed(); var canEmbed = oembed.CanEmbed("http://www.flickr.com/photos/gsfc/6760135001/"); Assert.IsTrue(canEmbed); }
public void EmbedForYouTube() { var oembed = new OEmbed(); var actual = oembed.Embed("http://www.youtube.com/watch?v=GYZRWdne5Uo"); Assert.IsNotNull(actual); }
public async Task EmbedAsyncForYouTube() { var oembed = new OEmbed(); var actual = await oembed.EmbedAsync("http://www.youtube.com/watch?v=GYZRWdne5Uo"); Assert.IsNotNull(actual); }
public void CanEmbedForYouTube() { var oembed = new OEmbed(); var canEmbed = oembed.CanEmbed("http://www.youtube.com/watch?v=GYZRWdne5Uo"); Assert.IsTrue(canEmbed); }
public OEmbedViewModel(OEmbed oEmbed) { Type = oEmbed.Type; Version = oEmbed.Version; ProviderName = oEmbed.ProviderName; ProviderUrl = oEmbed.ProviderUrl; Title = oEmbed.Title; AuthorName = oEmbed.AuthorName; AuthorUrl = oEmbed.AuthorUrl; IsPlus = oEmbed.IsPlus; AccountType = oEmbed.AccountType; Html = oEmbed.Html; Duration = oEmbed.Duration; Description = oEmbed.Description; ThumbnailUrl = oEmbed.ThumbnailUrl; ThumbnailWidth = oEmbed.ThumbnailWidth; ThumbnailHeight = oEmbed.ThumbnailHeight; ThumbnailUrlWithPlayButton = oEmbed.ThumbnailUrlWithPlayButton; UploadDate = oEmbed.UploadDate; VideoId = oEmbed.VideoId; Uri = oEmbed.Uri; }