mirror of https://github.com/readrops/Readrops.git
Parsing feeds which have a text/html content-type
This commit is contained in:
parent
edbff99c4f
commit
f384d5b9c8
|
@ -10,6 +10,7 @@ public final class Utils {
|
||||||
public static final String RSS_APPLICATION_CONTENT_TYPE = "application/xml";
|
public static final String RSS_APPLICATION_CONTENT_TYPE = "application/xml";
|
||||||
public static final String ATOM_CONTENT_TYPE = "application/atom+xml";
|
public static final String ATOM_CONTENT_TYPE = "application/atom+xml";
|
||||||
public static final String JSON_CONTENT_TYPE = "application/json";
|
public static final String JSON_CONTENT_TYPE = "application/json";
|
||||||
|
public static final String HTML_CONTENT_TYPE = "text/html";
|
||||||
|
|
||||||
public static String inputStreamToString(InputStream input) {
|
public static String inputStreamToString(InputStream input) {
|
||||||
Scanner scanner = new Scanner(input).useDelimiter("\\A");
|
Scanner scanner = new Scanner(input).useDelimiter("\\A");
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class RSSNetwork {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
RSSType type = getRSSType(header);
|
RSSType type = getRSSType(header);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
callback.onSyncFailure(new IllegalArgumentException("bad content type"));
|
callback.onSyncFailure(new IllegalArgumentException("bad content type : " + header + "for " + url));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,8 @@ public class RSSNetwork {
|
||||||
return RSSType.RSS_ATOM;
|
return RSSType.RSS_ATOM;
|
||||||
case Utils.JSON_CONTENT_TYPE:
|
case Utils.JSON_CONTENT_TYPE:
|
||||||
return RSSType.RSS_JSON;
|
return RSSType.RSS_JSON;
|
||||||
|
case Utils.HTML_CONTENT_TYPE:
|
||||||
|
return RSSType.RSS_UNKNOWN;
|
||||||
default:
|
default:
|
||||||
Log.d(TAG, "bad content type : " + contentType);
|
Log.d(TAG, "bad content type : " + contentType);
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue