public override GetLinkPreviewResponse CreatePreview(DataProviderInformation dataProviderInformation) { OEmbedInformation oembedInformation = (OEmbedInformation)dataProviderInformation; string text = oembedInformation.Text; OEmbedResponse oembedResponse = oembedInformation.OEmbedResponse; LinkPreviewBuilder linkPreviewBuilder = new OEmbedVideoPreviewBuilder(this.request, text, oembedResponse, this.logger, dataProviderInformation.ResponseUri); return(linkPreviewBuilder.Execute()); }
protected override async Task <DataProviderInformation> GetDataProviderInformation(HttpClient httpClient) { DataProviderInformation result; if (this.request.Id.StartsWith("UpdateOEmbed")) { result = await base.MakeAndProcessHttpRequest(httpClient, OEmbedDataProvider.GetOEmbedRequestUri(this.uri), new LinkPreviewDataProvider.ProcessResponseStreamDelegate(OEmbedDataProvider.ProcessOEmbedResponseStream)); } else { WebPageInformation webPageInformation = (WebPageInformation)(await base.MakeAndProcessHttpRequest(httpClient, this.uri, new LinkPreviewDataProvider.ProcessResponseStreamDelegate(WebPageDataProvider.ProcessResponseStream))); OEmbedInformation oembedInformation = (OEmbedInformation)(await base.MakeAndProcessHttpRequest(httpClient, OEmbedDataProvider.GetOEmbedRequestUri(this.uri), new LinkPreviewDataProvider.ProcessResponseStreamDelegate(OEmbedDataProvider.ProcessOEmbedResponseStream))); oembedInformation.Text = webPageInformation.Text; result = oembedInformation; } return(result); }