OSDN Git Service

ZeroでWatchページからタイトルを取得する
[coroid/NicoBrowser.git] / src / nicobrowser / NicoHttpClient.java
index adf435b..0e40763 100644 (file)
@@ -660,18 +660,7 @@ public class NicoHttpClient {
      * @param content watchページコンテンツのストリーム.
      */
     private String getTitleInWatchPage(InputStream content) throws IOException {
-        final String TITLE_PARSE_STR_START = "<title>";
-        BufferedReader br = new BufferedReader(new InputStreamReader(content, "UTF-8"));
-        String ret;
-        while ((ret = br.readLine()) != null) {
-            final int index = ret.indexOf(TITLE_PARSE_STR_START);
-            if (index >= 0) {
-                String videoTitle = ret.substring(index + TITLE_PARSE_STR_START.length(), ret.indexOf(" ‐", index));
-                return videoTitle;
-            }
-        }
-        return "";
-
+        return Util.getTitle(content);
     }
 
     private static class GetRealVideoIdResult {