Exemple #1
0
        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);
        }
Exemple #2
0
        public void CanEmbedForHatenaBlog()
        {
            var oembed = new OEmbed();

            var canEmbed = oembed.CanEmbed("http://staff.hatenablog.com/entry/2014/09/03/153938");

            Assert.IsTrue(canEmbed);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public void CanEmbedForSlideShare()
        {
            var oembed = new OEmbed();

            var canEmbed = oembed.CanEmbed("http://www.slideshare.net/shibayan/knockout-11523371");

            Assert.IsTrue(canEmbed);
        }
Exemple #5
0
        public async Task EmbedAsyncForSlideShare()
        {
            var oembed = new OEmbed();

            var actual = await oembed.EmbedAsync("http://www.slideshare.net/shibayan/knockout-11523371");

            Assert.IsNotNull(actual);
        }
Exemple #6
0
        public async Task EmbedAsyncForFlickr()
        {
            var oembed = new OEmbed();

            var actual = await oembed.EmbedAsync("http://www.flickr.com/photos/gsfc/6760135001/");

            Assert.IsNotNull(actual);
        }
Exemple #7
0
        public void CanEmbedForFlickr()
        {
            var oembed = new OEmbed();

            var canEmbed = oembed.CanEmbed("http://www.flickr.com/photos/gsfc/6760135001/");

            Assert.IsTrue(canEmbed);
        }
Exemple #8
0
        public void EmbedForYouTube()
        {
            var oembed = new OEmbed();

            var actual = oembed.Embed("http://www.youtube.com/watch?v=GYZRWdne5Uo");

            Assert.IsNotNull(actual);
        }
Exemple #9
0
        public async Task EmbedAsyncForYouTube()
        {
            var oembed = new OEmbed();

            var actual = await oembed.EmbedAsync("http://www.youtube.com/watch?v=GYZRWdne5Uo");

            Assert.IsNotNull(actual);
        }
Exemple #10
0
        public void CanEmbedForYouTube()
        {
            var oembed = new OEmbed();

            var canEmbed = oembed.CanEmbed("http://www.youtube.com/watch?v=GYZRWdne5Uo");

            Assert.IsTrue(canEmbed);
        }
Exemple #11
0
 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;
 }