/**
* <p>
- * \83^\83C\83g\83\8b: \82³\82«\82ã\82Î\82·
+ * タイトル: さきゅばす
* </p>
*
* <p>
- * \90à\96¾: \83j\83R\83j\83R\93®\89æ\82Ì\93®\89æ\82ð\83R\83\81\83\93\83g\82Â\82«\82Å\95Û\91¶
+ * 説明: ニコニコ動画の動画をコメントつきで保存
* </p>
*
* <p>
- * \92\98\8dì\8c : Copyright (c) 2007 PSI
+ * 著作権: Copyright (c) 2007 PSI
* </p>
*
* <p>
- * \89ï\8eÐ\96¼:
+ * 会社名:
* </p>
*
- * @author \96¢\93ü\97Í
+ * @author 未入力
* @version 1.0
*/
public class NicoClient {
} else {
ConProxy = Proxy.NO_PROXY;
}
- // \83\8d\83O\83C\83\93
+ // ログイン
Logged_in = login();
StopFlag = flag;
}
}
/**
- * \93\8a\8de\8eÒ\83R\83\81\83\93\83g\82ð\83_\83E\83\93\83\8d\81[\83h\82·\82é.
- * @param vi \83r\83f\83I\8fî\95ñ.
- * @param file \83_\83E\83\93\83\8d\81[\83h\90æ\83t\83@\83C\83\8b.
- * @param status \90i\92»\92Ê\92m\83\8a\83X\83i.
- * @return \83_\83E\83\93\83\8d\81[\83h\82³\82ê\82½\83t\83@\83C\83\8b. \83_\83E\83\93\83\8d\81[\83h\82Å\82«\82È\82¯\82ê\82Înull.
+ * 投稿者コメントをダウンロードする.
+ * @param vi ビデオ情報.
+ * @param file ダウンロード先ファイル.
+ * @param status 進捗通知リスナ.
+ * @return ダウンロードされたファイル. ダウンロードできなければnull.
*/
public File getTcomment(VideoInfo vi, final File file, final TextProgressListener status) {
return downloadComment("500", file, vi, status, true);
boolean isTcomm) throws NumberFormatException {
System.out.print("Downloading comment size:" + back_comment + "...");
try {
- if (file.canRead()) { // \83t\83@\83C\83\8b\82ª\82·\82Å\82É\91¶\8dÝ\82·\82é\82È\82ç\8dí\8f\9c\82·\82é\81B
+ if (file.canRead()) { // ファイルがすでに存在するなら削除する。
file.delete();
}
OutputStream fos = new FileOutputStream(file);
if (max_size != 0) {
String per = Double.toString((((double) size) * 100) / max_size);
per = per.substring(0, Math.min(per.indexOf(".") + 3, per.length()));
- status.setText("\83R\83\81\83\93\83g\83_\83E\83\93\83\8d\81[\83h\81F" + per + "\83p\81[\83Z\83\93\83g\8a®\97¹");
+ status.setText("コメントダウンロード:" + per + "パーセント完了");
} else {
- status.setText("\83R\83\81\83\93\83g\83_\83E\83\93\83\8d\81[\83h\92\86\81F" + Integer.toString(size >> 10) + "kbytes\83_\83E\83\93\83\8d\81[\83h");
+ status.setText("コメントダウンロード中:" + Integer.toString(size >> 10) + "kbytesダウンロード");
}
if (StopFlag.needStop()) {
System.out.println("Stopped.");
return null;
}
try {
-// if (file.canRead()) { // \83t\83@\83C\83\8b\82ª\82·\82Å\82É\91¶\8dÝ\82·\82é\82È\82ç\8dí\8f\9c\82·\82é\81B
+// if (file.canRead()) { // ファイルがすでに存在するなら削除する。
// file.delete();
// }
HttpURLConnection con = (HttpURLConnection) (new URL(vi.getVideoUrl()))
.openConnection(ConProxy);
- /* \8fo\97Í\82Ì\82Ý */
+ /* 出力のみ */
con.setDoInput(true);
con.setRequestMethod("GET");
con.addRequestProperty("Cookie", Cookie);
/ max_size);
per = per.substring(0, Math.min(per.indexOf(".") + 3, per
.length()));
- status.setText("\93®\89æ\83_\83E\83\93\83\8d\81[\83h\81F" + per + "\83p\81[\83Z\83\93\83g\8a®\97¹");
+ status.setText("動画ダウンロード:" + per + "パーセント完了");
} else {
- status.setText("\93®\89æ\83_\83E\83\93\83\8d\81[\83h\92\86\81F" + Integer.toString(size >> 10)
- + "kbytes\83_\83E\83\93\83\8d\81[\83h");
+ status.setText("動画ダウンロード中:" + Integer.toString(size >> 10)
+ + "kbytesダウンロード");
}
if (StopFlag.needStop()) {
System.out.println("Stopped.");
return null;
}
- /** @return \83r\83f\83I\96¼ */
+ /** @return ビデオ名 */
public String getVideoHistoryAndTitle(String tag) throws IOException {
String url = "http://www.nicovideo.jp/watch/" + tag;
System.out.print("Getting video history...");
String videoTitle = null;
HttpURLConnection con = (HttpURLConnection) (new URL(url)).openConnection(ConProxy);
- /* \83\8a\83N\83G\83X\83g\82Ì\90Ý\92è */
+ /* リクエストの設定 */
con.setRequestMethod("GET");
con.addRequestProperty("Cookie", Cookie);
con.addRequestProperty("Connection", "close");
int index = -1;
while ((ret = br.readLine()) != null && index < 0) {
if ((index = ret.indexOf(TITLE_PARSE_STR_START)) >= 0) {
- videoTitle = ret.substring(index + TITLE_PARSE_STR_START.length(), ret.indexOf("\81]", index));
+ videoTitle = ret.substring(index + TITLE_PARSE_STR_START.length(), ret.indexOf("‐", index));
videoTitle = FileUtil.safeFileName(videoTitle);
}
}
try {
HttpURLConnection con = (HttpURLConnection) (new URL(url))
.openConnection(ConProxy);
- /* \83\8a\83N\83G\83X\83g\82Ì\90Ý\92è */
+ /* リクエストの設定 */
con.setRequestMethod("GET");
con.addRequestProperty("Cookie", Cookie);
con.addRequestProperty("Connection", "close");
System.out.println("Can't get WayBackKey:" + url);
return false;
}
- /* \96ß\82è\92l\82Ì\8eæ\93¾ */
+ /* 戻り値の取得 */
BufferedReader br = new BufferedReader(new InputStreamReader(con
.getInputStream()));
ret = br.readLine();
HttpURLConnection con = (HttpsURLConnection) (new URL(
"https://secure.nicovideo.jp/secure/login?site=niconico"))
.openConnection(ConProxy);
- /* \8fo\97Í\82Ì\82Ý */
+ /* 出力のみ */
con.setDoOutput(true);
HttpURLConnection.setFollowRedirects(false);
con.setInstanceFollowRedirects(false);
Map<String, String> map = new HashMap<String, String>();
System.out.print("Getting video informations...");
HttpURLConnection con = (HttpURLConnection) (new URL(url)).openConnection(ConProxy);
- /* \83\8a\83N\83G\83X\83g\82Ì\90Ý\92è */
+ /* リクエストの設定 */
con.setRequestMethod("GET");
con.addRequestProperty("Cookie", Cookie);
con.addRequestProperty("Connection", "close");
if (con.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new IOException("Can't getVideoInfo:" + url);
}
- /* \96ß\82è\92l\82Ì\8eæ\93¾ */
+ /* 戻り値の取得 */
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
String ret = br.readLine();
br.close();