+ * watchページコンテンツからタイトルを抽出する.
+ * @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 "";
+
+ }
+
+ private static class GetRealVideoIdResult {
+
+ private final String videoId;
+ private final String title;
+
+ private GetRealVideoIdResult(String videoId, String title) {
+ this.videoId = videoId;
+ this.title = title;
+ }
+ }
+
+ /**