AngelList API - 启动ID

时间:2014-11-09 17:35:57

标签: java

我是开发人员,我想知道创业公司ID是否适用于需要使用AngelList API的开发人员。

有人可以帮帮我吗?

这是我的代码:

int f = 1;
// Reading Json data from Rest API and paginating it.
for(int h = 1000; h<=10000; h++){
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    System.out.println("Start downloading pages from AngelList..");
    Date date = new Date();
    System.out.println(dateFormat.format(date));
    String URL = "https://api.angel.co/1/startups/" + h;
    InputStream in = null;
    try{
        in = URI.create(URL).toURL().openStream();
    }catch(FileNotFoundException e){
        System.out.println(e.getMessage());
    }
    catch(IOException e){
        System.out.println(e.getMessage());
        Date date2 = new Date();
        System.out.println("Begin: " + dateFormat.format(date) + " Now: "+ dateFormat.format(date2));
        System.out.println("I've done 1000 requests, wait 60 min...");
        h--;
        in = null;
        TimeUnit.MINUTES.sleep(60);
    }
    if(in!=null){
        // writing each page into a separate file if in is not null
        FileOutputStream fout = new FileOutputStream(
                "/my-path/file" + f + ".txt");
        f++;
        byte data[] = new byte[1024];
        int count;
        while ((count = in.read(data, 0, 1024)) != -1) {
            fout.write(data, 0, count);
        }
        fout.close();
    }
}

它工作正常,但我会知道ID,因为目前我已经选择了随机(1000 - 10000)。

0 个答案:

没有答案