// Token: 0x060018DA RID: 6362 RVA: 0x00056208 File Offset: 0x00054408
        protected virtual string GetDescription(out int descriptionTagCount)
        {
            string attributeValue = this.GetAttributeValue(this.responseString, WebPageLinkPreviewBuilder.GetDescriptionTagRegEx, "descriptionTag", WebPageLinkPreviewBuilder.GetDescriptionAttributeRegEx, "description", "description", out descriptionTagCount);

            this.logger.Set(GetLinkPreviewMetadata.DescriptionLength, WebPageLinkPreviewBuilder.GetStringLength(attributeValue));
            return(WebPageLinkPreviewBuilder.Truncate(attributeValue, 1000));
        }
        // Token: 0x060018D3 RID: 6355 RVA: 0x00055FA8 File Offset: 0x000541A8
        private static string[] CreateHtmlTagsToRemove()
        {
            List <string> list = new List <string>(12);

            WebPageLinkPreviewBuilder.AddToTagList(list, "i");
            WebPageLinkPreviewBuilder.AddToTagList(list, "b");
            WebPageLinkPreviewBuilder.AddToTagList(list, "u");
            return(list.ToArray());
        }
예제 #3
0
        protected override string GetTitle()
        {
            string text = this.oEmbedResponse.Title;

            if (text != null)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(text);
                text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
                return(WebPageLinkPreviewBuilder.Truncate(text, 400));
            }
            return(null);
        }
예제 #4
0
        protected override string GetTitle()
        {
            string text  = null;
            Match  match = LinkPreviewBuilder.ExecuteRegEx(WikipediaLinkPreviewBuilder.GetTitleRegEx, this.responseString, "title");

            if (match.Groups["title"].Captures.Count > 0)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups["title"].Value);
            }
            this.logger.Set(GetLinkPreviewMetadata.TitleLength, WebPageLinkPreviewBuilder.GetStringLength(text));
            return(WebPageLinkPreviewBuilder.Truncate(text, 400));
        }
예제 #5
0
        // Token: 0x060018E2 RID: 6370 RVA: 0x000563C4 File Offset: 0x000545C4
        protected override string GetDescription(out int descriptionTagCount)
        {
            string text  = null;
            Match  match = LinkPreviewBuilder.ExecuteRegEx(CraigsListLinkPreviewBuilder.GetDescriptionRegEx, this.responseString, "description");

            descriptionTagCount = match.Groups["description"].Captures.Count;
            if (descriptionTagCount > 0)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups["description"].Value);
                text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
            }
            this.logger.Set(GetLinkPreviewMetadata.DescriptionLength, WebPageLinkPreviewBuilder.GetStringLength(text));
            return(WebPageLinkPreviewBuilder.Truncate(text, 1000));
        }
예제 #6
0
        protected override string GetDescription(out int descriptionTagCount)
        {
            string text = null;

            descriptionTagCount = 0;
            Match match = LinkPreviewBuilder.ExecuteRegEx(WikipediaLinkPreviewBuilder.GetDescriptionRegEx, this.responseString, "title");

            if (match.Groups["description"].Captures.Count > 0)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups["description"].Value);
                descriptionTagCount = 1;
            }
            this.logger.Set(GetLinkPreviewMetadata.DescriptionLength, WebPageLinkPreviewBuilder.GetStringLength(text));
            return(WebPageLinkPreviewBuilder.Truncate(text, 1000));
        }
        // Token: 0x060018D1 RID: 6353 RVA: 0x00055EB4 File Offset: 0x000540B4
        protected string GetAttributeValue(string responseString, Regex getTagRegex, string tagRegexKey, Regex getAttributeRegex, string attributeRegexKey, string propertyName, out int tagCount)
        {
            string          text            = null;
            MatchCollection matchCollection = LinkPreviewBuilder.ExecuteRegExForMatchCollection(getTagRegex, responseString, propertyName);

            tagCount = matchCollection.Count;
            if (tagCount > 0)
            {
                Match match = LinkPreviewBuilder.ExecuteRegEx(getAttributeRegex, matchCollection[0].Value, propertyName);
                if (match.Groups[attributeRegexKey].Captures.Count > 0)
                {
                    text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups[attributeRegexKey].Value);
                    text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
                }
            }
            return(text);
        }
예제 #8
0
        // Token: 0x0600194A RID: 6474 RVA: 0x00057EF4 File Offset: 0x000560F4
        public override GetLinkPreviewResponse CreatePreview(DataProviderInformation dataProviderInformation)
        {
            string text = ((WebPageInformation)dataProviderInformation).Text;
            Dictionary <string, string> queryParmDictionary;
            LinkPreviewBuilder          linkPreviewBuilder;

            if (YouTubeLinkPreviewBuilder.TryGetYouTubePlayerQueryParms(dataProviderInformation.ResponseUri, this.logger, out queryParmDictionary))
            {
                linkPreviewBuilder = new YouTubeLinkPreviewBuilder(queryParmDictionary, this.request, text, this.logger, dataProviderInformation.ResponseUri);
            }
            else if (AmazonLinkPreviewBuilder.IsAmazonUri(dataProviderInformation.ResponseUri))
            {
                linkPreviewBuilder = new AmazonLinkPreviewBuilder(this.request, text, this.logger, dataProviderInformation.ResponseUri);
            }
            else if (CraigsListLinkPreviewBuilder.IsCraigsListUri(dataProviderInformation.ResponseUri))
            {
                linkPreviewBuilder = new CraigsListLinkPreviewBuilder(this.request, text, this.logger, dataProviderInformation.ResponseUri);
            }
            else
            {
                linkPreviewBuilder = new WebPageLinkPreviewBuilder(this.request, text, this.logger, dataProviderInformation.ResponseUri, false);
            }
            return(linkPreviewBuilder.Execute());
        }