Example #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);
        }
Example #2
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);
        }
Example #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));
        }
Example #4
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));
        }
Example #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));
        }
Example #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);
        }
Example #8
0
        // Token: 0x06001962 RID: 6498 RVA: 0x00058764 File Offset: 0x00056964
        protected override void SetAdditionalProperties(LinkPreview linkPreview)
        {
            string        format        = this.autoplay ? "https://www.youtube.com/embed/{0}?autoplay=1" : "https://www.youtube.com/embed/{0}";
            string        value         = LinkPreviewBuilder.ConvertToSafeHtml(string.Format(format, this.youTubeId));
            StringBuilder stringBuilder = new StringBuilder(value);
            int           startTime     = this.GetStartTime();

            if (startTime > 0)
            {
                if (!this.autoplay)
                {
                    stringBuilder.Append('?');
                }
                else
                {
                    stringBuilder.Append('&');
                }
                stringBuilder.Append("start");
                stringBuilder.Append('=');
                stringBuilder.Append(startTime);
            }
            ((YouTubeLinkPreview)linkPreview).PlayerUrl = stringBuilder.ToString();
        }
Example #9
0
 // Token: 0x06001964 RID: 6500 RVA: 0x0005886B File Offset: 0x00056A6B
 protected override string GetImage(out int imageTagCount)
 {
     imageTagCount = 1;
     return(LinkPreviewBuilder.ConvertToSafeHtml(string.Format("http://img.youtube.com/vi/{0}/0.jpg", this.youTubeId)));
 }