forked from Archives/Athou_commafeed
remove www from normalized url
This commit is contained in:
@@ -104,6 +104,7 @@ public class FeedUtils {
|
||||
if (normalized.startsWith("https")) {
|
||||
normalized = "http" + normalized.substring(5);
|
||||
}
|
||||
normalized = normalized.replace("//www.", "//");
|
||||
normalized = normalized.replace("feeds2.feedburner.com", "feeds.feedburner.com");
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@ public class FeedUtilsTest {
|
||||
@Test
|
||||
public void testNormalization() {
|
||||
String urla1 = "http://example.com/hello?a=1&b=2";
|
||||
String urla2 = "http://EXAmPLe.com/HELLo?a=1&b=2";
|
||||
String urla3 = "http://example.com/hello?b=2&a=1";
|
||||
String urla4 = "https://example.com/hello?a=1&b=2";
|
||||
String urla2 = "http://www.example.com/hello?a=1&b=2";
|
||||
String urla3 = "http://EXAmPLe.com/HELLo?a=1&b=2";
|
||||
String urla4 = "http://example.com/hello?b=2&a=1";
|
||||
String urla5 = "https://example.com/hello?a=1&b=2";
|
||||
|
||||
String urlb1 = "http://ftr.fivefilters.org/makefulltextfeed.php?url=http%3A%2F%2Ffeeds.howtogeek.com%2FHowToGeek&max=10&summary=1";
|
||||
String urlb2 = "http://ftr.fivefilters.org/makefulltextfeed.php?url=http://feeds.howtogeek.com/HowToGeek&max=10&summary=1";
|
||||
@@ -21,6 +22,7 @@ public class FeedUtilsTest {
|
||||
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla2));
|
||||
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla3));
|
||||
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla4));
|
||||
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla5));
|
||||
|
||||
Assert.assertEquals(FeedUtils.normalizeURL(urlb1), FeedUtils.normalizeURL(urlb2));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user