Don't depend on protocol in video regex

This commit is contained in:
2014-01-11 10:00:00 +01:00
parent 466518d57c
commit 845b1438fb
2 changed files with 13 additions and 11 deletions
@@ -111,7 +111,7 @@ namespace ReadSharp.Ports.NReadability
private static readonly Regex _BreakBeforeParagraphRegex = new Regex("<br[^>]*>\\s*<p");
private static readonly Regex _NormalizeSpacesRegex = new Regex("\\s{2,}");
private static readonly Regex _KillBreaksRegex = new Regex("(<br\\s*\\/?>(\\s|&nbsp;?)*){1,}");
private static readonly Regex _VideoRegex = new Regex("http:\\/\\/(www\\.)?(youtube|vimeo)\\.com", RegexOptions.IgnoreCase);
private static readonly Regex _VideoRegex = new Regex("\\/\\/(www\\.)?(youtube|vimeo)\\.com", RegexOptions.IgnoreCase);
private static readonly Regex _ReplaceDoubleBrsRegex = new Regex("(<br[^>]*>[ \\n\\r\\t]*){2,}", RegexOptions.IgnoreCase);
private static readonly Regex _ReplaceFontsRegex = new Regex("<(\\/?)font[^>]*>", RegexOptions.IgnoreCase);
private static readonly Regex _ArticleTitleDashRegex1 = new Regex(" [\\|\\-] ");
@@ -1435,6 +1435,8 @@ namespace ReadSharp.Ports.NReadability
var elementsToRemove = new List<XElement>();
// TODO: proof iframe videos
foreach (XElement element in elements)
{
/* Allow youtube and vimeo videos through as people usually want to see those. */
+10 -10
View File
@@ -124,17 +124,17 @@ namespace ReadSharp.Tests
Assert.Equal(result.Title, expectedTitle);
}
//[Fact]
//public async Task TestCriticalURIs()
//{
// //Article result = await reader.Read(new Uri("http://www.jetbrains.com/resharper/whatsnew/index.html"));
// //Assert.NotEmpty(result.Content);
[Fact]
public async Task TestCriticalURIs()
{
Article result = await reader.Read(new Uri("http://wpcentral.com.feedsportal.com/c/33999/f/616880/s/35a02b5e/sc/15/l/0L0Swpcentral0N0Cgameloft0Ediscusses0Etheir0Enew0Egame0Ebrothers0Earms0E30Esons0Ewar0Eceslive/story01.htm"));
Assert.NotEmpty(result.Content);
// //result = await reader.Read(new Uri("http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx"));
// //Assert.NotEmpty(result.Content);
//result = await reader.Read(new Uri("http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx"));
//Assert.NotEmpty(result.Content);
// //Article result = await reader.Read(new Uri("http://bit.ly/KAh7FJ"));
// //Assert.NotEmpty(result.Content);
//}
//Article result = await reader.Read(new Uri("http://bit.ly/KAh7FJ"));
//Assert.NotEmpty(result.Content);
}
}
}