1
0
mirror of https://github.com/rudollee/HTMLParser.git synced 2025-06-07 16:06:09 +00:00
This commit is contained in:
wook 2017-05-10 13:41:49 +09:00
parent fd30db4aa2
commit 3b7e55dbbd

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq;
namespace HTMLParser namespace HTMLParser
{ {
@ -36,7 +37,6 @@ namespace HTMLParser
if (string.IsNullOrEmpty(article)) return string.Empty; if (string.IsNullOrEmpty(article)) return string.Empty;
string pttrn = @"((?:(?:https?|http|ftp|gopher|telnet|file|notes|ms-help):(?://|\\\\)(?:www\.)?|www\.)[\w\d:#@%/;$()~_?\+,\-=\\.&]+)"; string pttrn = @"((?:(?:https?|http|ftp|gopher|telnet|file|notes|ms-help):(?://|\\\\)(?:www\.)?|www\.)[\w\d:#@%/;$()~_?\+,\-=\\.&]+)";
string lnk = "<a href=\"$1\" target=\"_blank\">$1</a>"; string lnk = "<a href=\"$1\" target=\"_blank\">$1</a>";
return Regex.Replace(article, pttrn, lnk, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(150)).Replace("href=\"www.", "href=\"http://www."); return Regex.Replace(article, pttrn, lnk, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(150)).Replace("href=\"www.", "href=\"http://www.");
@ -75,7 +75,7 @@ namespace HTMLParser
public string ParseUrlAndYoutube(string article) public string ParseUrlAndYoutube(string article)
{ {
return this.ParseYoutube(this.ParseUrl(article)); return this.GenerateYoutubeScripts(article).First() + this.ParseYoutube(this.ParseUrl(article));
} }
} }
} }