public static Integer idFromUrl(String url) {
        Pattern idPattern = Pattern.compile("http://myanimelist.net/(\\w+)/(\\d+)/?.*");
        Matcher matcher = idPattern.matcher(url);
        if (matcher.find()) {
            return Integer.valueOf(matcher.group(2));
        }
        return 0;
    }