Skip to content

Instantly share code, notes, and snippets.

@orekyuu
Created August 2, 2015 16:55
Show Gist options
  • Select an option

  • Save orekyuu/5340e7c58812e7083ef9 to your computer and use it in GitHub Desktop.

Select an option

Save orekyuu/5340e7c58812e7083ef9 to your computer and use it in GitHub Desktop.
package net.orekyuu.demo;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
System.out.println(webEngine.executeScript("$('.tweet-text').text()"));
}
}
});
webEngine.load("https://twitter.com/orekyuu/status/627868877070798848");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment