Twitter 在java中使用HTTPURLConnection加载更多数据

Twitter 在java中使用HTTPURLConnection加载更多数据,twitter,httpurlconnection,twitter4j,httpconnection,Twitter,Httpurlconnection,Twitter4j,Httpconnection,在我的程序中,我使用HTTPURLConnection读取数据 URL url = new URL("https://twitter.com/search?q="+kw+"%20lang%3Aeng%20"+"&src=typd&lang=en"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn

在我的程序中,我使用HTTPURLConnection读取数据

  URL url = new URL("https://twitter.com/search?q="+kw+"%20lang%3Aeng%20"+"&src=typd&lang=en");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();

    conn.setRequestMethod("GET");
    conn.setRequestProperty("Accept", "application/json");

    if (conn.getResponseCode() != 200) {
        throw new RuntimeException("Failed : HTTP error code : "
                + conn.getResponseCode());
    }

    String line;
    StringBuilder builder = new StringBuilder();
    BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    while ((line = reader.readLine()) != null) {
        builder.append(line);
        builder.append("\n");
    }
    String html = builder.toString();
问题是只读取响应页面上的数据,但我需要读取所有可以检索的数据


如何在结果页面加载更多数据

当您使用Twitter API时,为什么要使用
HttpURLConnection
?感谢您的回复,因为twitter api只检索上周的数据,以及我在几个月内需要的数据。我的问题有什么解决方案吗?你可以试试历史API之类的,但它们可能会让你付出代价。为什么你在使用Twitter API时使用
HttpURLConnection
?感谢您的回复,因为twitter api只检索上周的数据,以及我在几个月内需要的数据。我的问题有什么解决方案吗?你可以试试历史API之类的,但它们可能会让你付出代价。为什么你在使用Twitter API时使用
HttpURLConnection
?感谢您的回复,因为twitter api只检索上周的数据,以及我在几个月内需要的数据。我的问题有什么解决办法吗?你可以试试历史API之类的,但它们可能会让你付出代价