OSDN Git Service

getWayBackKeyメソッドではwaybackkey取得のみを行うようにインタフェースを定義しなおし
[coroid/inqubus.git] / frontend / src / saccubus / net / NicoClientImpl.java
index a540fa0..1a808b7 100644 (file)
@@ -14,14 +14,9 @@ import java.net.InetSocketAddress;
 import java.net.Proxy;
 import java.net.URLEncoder;
 import java.net.URLDecoder;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import javax.net.ssl.HttpsURLConnection;
-import org.apache.commons.lang.StringUtils;
 import saccubus.ConvertStopFlag;
 import saccubus.util.FileUtil;
 import yukihane.Util;
@@ -325,44 +320,8 @@ public class NicoClientImpl implements NicoClient {
     }
 
     @Override
-    public CommentInfo getWayBackKey(VideoInfo vi, String time) throws IOException {
-        if (StringUtils.isBlank(time)) {
-            return CommentInfo.DEFAULT;
-        }
+    public String getWayBackKey(VideoInfo vi) throws IOException {
 
-        System.out.print("Setting wayback time...");
-        Date date = null;
-        String waybacktime = "0";
-        try {
-            final DateFormat fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-            date = fmt.parse(time);
-        } catch (ParseException ex2) {
-            date = null;
-        }
-        if (date == null) {
-            try {
-                final DateFormat fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm");
-                date = fmt.parse(time);
-            } catch (ParseException ex3) {
-                date = null;
-            }
-        }
-        if (date != null) {
-            waybacktime = Long.toString(date.getTime() / 1000);
-            System.out.println("ok.(" + date.toString() + "):" + waybacktime);
-        } else {
-            try {
-                long tmp_time = Long.parseLong(time);
-                waybacktime = Long.toString(tmp_time);
-                date = new Date(tmp_time * 1000);
-                System.out.println("ok.(" + date.toString() + "):"
-                        + waybacktime);
-            } catch (NumberFormatException ex4) {
-                System.out.println("ng.");
-                System.out.println("Cannot parse wayback time.");
-                throw new IOException("Cannot parse wayback time.", ex4);
-            }
-        }
         System.out.print("Getting wayback key...");
         String url = "http://flapi.nicovideo.jp/api/getwaybackkey?thread="
                 + vi.getThreadId();
@@ -407,7 +366,7 @@ public class NicoClientImpl implements NicoClient {
             throw new IOException("Cannot get wayback key.");
         }
         System.out.println("ok. key:" + waybackkey);
-        return new CommentInfo(waybackkey, waybacktime);
+        return waybackkey;
     }
 
     @Override