Created
August 2, 2015 16:55
-
-
Save orekyuu/5340e7c58812e7083ef9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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