30 lines
892 B
C#
30 lines
892 B
C#
using System.Collections.Generic;
|
|
using Umbraco.Core.Serialization;
|
|
|
|
namespace Umbraco.Web.Media.EmbedProviders
|
|
{
|
|
public class Twitter : EmbedProviderBase
|
|
{
|
|
public override string ApiEndpoint => "http://publish.twitter.com/oembed";
|
|
|
|
public override string[] UrlSchemeRegex => new string[]
|
|
{
|
|
@"twitter.com/.*/status/.*"
|
|
};
|
|
|
|
public override Dictionary<string, string> RequestParams => new Dictionary<string, string>();
|
|
|
|
public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0)
|
|
{
|
|
var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight);
|
|
var oembed = base.GetJsonResponse<OEmbedResponse>(requestUrl);
|
|
|
|
return oembed.GetHtml();
|
|
}
|
|
|
|
public Twitter(IJsonSerializer jsonSerializer) : base(jsonSerializer)
|
|
{
|
|
}
|
|
}
|
|
}
|