Code Monkey home page Code Monkey logo

embedphantomjs's Introduction

embedphantomjs

Embedded PhantomJS for Java

This project provides an easy interface for execute PhantomJS with Java.

Why?

  • Easy way to execute JS inside Java
  • Easy way to make a Scraper with Java

Maven

Stable OSS Sonatype

	<dependency>
		<groupId>com.github.jarlakxen</groupId>
		<artifactId>embedphantomjs</artifactId>
		<version>3.0</version>
	</dependency>

Changelog

  • 3.0

    • Move to Java 8
    • Remove Guava dependancy, switch to CompletableFuture
  • 2.9

    • Jarlakxen#3
    • Update dependancies
    • Sopport for versions last versions of PhantomJS
    • Move PhantomJS download url to bitbucket.
  • 2.8

    • Better windows support ( Thanks to @Dmitry-Shweikus )
  • 2.7

    • Unify Sync and Async interfaces for PhantomJSFileExecutor
    • Improve error handling
  • 2.6

    • Some API improvments in PhantomJSFileExecutor
    • Improve the core of the PhantomJSConsoleExecutor
  • 2.5

    • Some API improvments
  • 2.4

    • Provide some basic information of the PhantomJS process
    • Better exception handling
  • 2.3

    • Bug fixing
  • 2.2

    • Mejor API Refactor
    • Now supports console style executor
  • 2.1

    • Add asyncronic execution
  • 2.0

    • Sopport for versions 1.9.2, 1.9.1, 1.9.0, 1.8.2, 1.8.1, 1.8.0
    • Sopport binary versioned
  • 1.3

    • Full support for input stream script
  • 1.2

    • Bug fixing
  • 1.1

    • Bug fixing
  • 1.0

    • Auto-detect OS
    • Auto-detect architecture
    • Sopport for versions 1.7.0, 1.6.1, 1.6.0, 1.5.0, 1.4.1, 1.4.0, 1.3.0
    • Check native installation
    • Download from page

Supported Versions

Versions: 2.1.1, 1.9.8, 1.9.7, 1.9.6, 1.9.5, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9.0, 1.8.2, 1.8.1, 1.8.0, 1.7.0, 1.6.1, 1.6.0, 1.5.0, 1.4.1, 1.4.0, 1.3.0 Support for Linux, Windows and MacOSX.

Usage

####Example I:

PhantomJSFileExecutor ex = new PhantomJSFileExecutor(PhantomJSReference.create().build(), new ExecutionTimeout(1, TimeUnit.SECONDS));
String output = executor.execute(new File("~/scrapper.js")).get();
System.out.println(output);  // This prints "TEST1"

####Example II:

PhantomJSFileExecutor ex = new new PhantomJSFileExecutor(PhantomJSReference.create().build(), new ExecutionTimeout(1, TimeUnit.SECONDS));
String output = executor.execute("console.log('TEST1');phantom.exit();").get()
System.out.println(output);  // This prints "TEST1"

####Example III:

PhantomJSConsoleExecutor ex = new PhantomJSConsoleExecutor(PhantomJSReference.create().build());
ex.start();
ex.execute("var system = require('system');");
	System.out.println(ex.execute("system.stdout.writeLine('TEST1');", "true")); // This prints "TEST1"
	System.out.println( ex.execute("system.stdout.writeLine('TEST2');", "true")); // This prints "TEST2"
	ex.destroy();

Bitdeli Badge

embedphantomjs's People

Contributors

dmitry-shweikus avatar jarlakxen avatar jdeanquin-dg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.