From f384d5b9c8e4fae7cb2864b87d43548c75aa05c9 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Wed, 6 Feb 2019 13:15:40 +0000 Subject: [PATCH] Parsing feeds which have a text/html content-type --- .../main/java/com/readrops/readropslibrary/Utils/Utils.java | 1 + .../com/readrops/readropslibrary/localfeed/RSSNetwork.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/readropslibrary/src/main/java/com/readrops/readropslibrary/Utils/Utils.java b/readropslibrary/src/main/java/com/readrops/readropslibrary/Utils/Utils.java index 3e27f9f3..d50c4eed 100644 --- a/readropslibrary/src/main/java/com/readrops/readropslibrary/Utils/Utils.java +++ b/readropslibrary/src/main/java/com/readrops/readropslibrary/Utils/Utils.java @@ -10,6 +10,7 @@ public final class Utils { public static final String RSS_APPLICATION_CONTENT_TYPE = "application/xml"; public static final String ATOM_CONTENT_TYPE = "application/atom+xml"; public static final String JSON_CONTENT_TYPE = "application/json"; + public static final String HTML_CONTENT_TYPE = "text/html"; public static String inputStreamToString(InputStream input) { Scanner scanner = new Scanner(input).useDelimiter("\\A"); diff --git a/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java b/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java index e7603ef9..dfc7ba85 100644 --- a/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java +++ b/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java @@ -54,7 +54,7 @@ public class RSSNetwork { if (response.isSuccessful()) { RSSType type = getRSSType(header); if (type == null) { - callback.onSyncFailure(new IllegalArgumentException("bad content type")); + callback.onSyncFailure(new IllegalArgumentException("bad content type : " + header + "for " + url)); return; } @@ -123,6 +123,8 @@ public class RSSNetwork { return RSSType.RSS_ATOM; case Utils.JSON_CONTENT_TYPE: return RSSType.RSS_JSON; + case Utils.HTML_CONTENT_TYPE: + return RSSType.RSS_UNKNOWN; default: Log.d(TAG, "bad content type : " + contentType); return null;