* @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 {