有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

如何在java应用程序中从facebook应用程序中提取源代码

嗨,我已经安装了一个java应用程序。我可以连接,这样我的facebook会话就可以验证了

我可以获取登录人的id和信息等,但我使用的应用程序无法获取内容

我用我自己的id试过了,但facebook似乎吐出了一大堆垃圾,我认为它认为我是某种机器人或蜘蛛。。。因为术语spider在垃圾中被引用了好几次

我的代码如下

public class m extends WebPage {

public m() {

    FaceBookSession session = (FaceBookSession) getSession();


        String contents = "";

    System.err.println("*****************************************************************");
    System.err.println("id ==================" + session.getId());
    System.err.println("name ==================" + session.getUserName());

    try {
        URL aURL = new URL("http://apps.facebook.com/<___>/profile.php?snuid=<__>");
        URLConnection aURLc = aURL.openConnection();
        BufferedReader in = new BufferedReader(new InputStreamReader(aURLc.getInputStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null) {
            contents = contents + " <br> " + inputLine;
            System.out.println(inputLine);
        }

        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

    this.add(new Label("username", session.getId()));
    this.add(new Label("user", session.getUserName()));
    this.add(new Label("id", contents));

    System.err.println("*****************************************************************");

有什么我能做的吗?我已经用我自己和我的账户试过了,我已经登录到facebook并使用了这个有问题的应用程序。但是当我运行这个程序时,我无法访问应用程序im usings页面来提取内容

我只希望能够访问我正在使用的所有应用程序,并在一个页面上显示它们的内容/页面

[编辑]-我很确定问题在于程序没有模拟浏览器或类似的东西、cookies等。程序没有传递所需的信息或其他信息。也许有一种方法可以先通过java程序“登录”,然后进入想要的页面

为任何帮助干杯


共 (0) 个答案