use of com.hippo.ehviewer.client.data.ListUrlBuilder in project EhViewer by seven332.
the class GalleryListUrlParser method parse.
public static ListUrlBuilder parse(String urlStr) {
URL url;
try {
url = new URL(urlStr);
} catch (MalformedURLException e) {
return null;
}
if (!Utilities.contain(VALID_HOSTS, url.getHost())) {
return null;
}
String path = url.getPath();
if (path == null) {
return null;
}
if (PATH_NORMAL.equals(path) || path.length() == 0) {
ListUrlBuilder builder = new ListUrlBuilder();
builder.setQuery(url.getQuery());
return builder;
} else if (path.startsWith(PATH_UPLOADER)) {
return parseUploader(path);
} else if (path.startsWith(PATH_TAG)) {
return parseTag(path);
} else if (path.startsWith("/")) {
int category;
try {
category = Integer.parseInt(path.substring(1));
} catch (NumberFormatException e) {
return null;
}
ListUrlBuilder builder = new ListUrlBuilder();
builder.setQuery(url.getQuery());
builder.setCategory(category);
return builder;
} else {
return null;
}
}
Aggregations