Ejemplo n.º 1
0
        // Token: 0x06001950 RID: 6480 RVA: 0x000582D8 File Offset: 0x000564D8
        private static string GetWebPageEncoding(string webPageString, Regex regEx, string propertyName)
        {
            string result = null;
            Match  match  = LinkPreviewBuilder.ExecuteRegEx(regEx, webPageString, propertyName);

            if (match.Groups["encoding"].Captures.Count > 0)
            {
                result = match.Groups["encoding"].Value;
            }
            return(result);
        }
Ejemplo n.º 2
0
        // Token: 0x060018E3 RID: 6371 RVA: 0x00056458 File Offset: 0x00054658
        protected override string GetImage(out int imageTagCount)
        {
            string imageUrl = null;
            Match  match    = LinkPreviewBuilder.ExecuteRegEx(CraigsListLinkPreviewBuilder.GetImageSrcRegEx, this.responseString, "image");

            imageTagCount = match.Groups["imageUrl"].Captures.Count;
            if (imageTagCount > 0)
            {
                imageUrl = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups["imageUrl"].Value);
            }
            return(base.GetImageUrlAbsolutePath(imageUrl));
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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);
        }