All Projects → udger → udger-java

udger / udger-java

Licence: MIT license
Java agent string parser based on Udger https://udger.com/products/local_parser

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to udger-java

udger-python
Python agent string parser based on Udger https://udger.com/products/local_parser
Stars: ✭ 34 (+41.67%)
Mutual labels:  user-agent-parser, device-detector, bot-detection, mobile-detection
Device Detector
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
Stars: ✭ 2,106 (+8675%)
Mutual labels:  device-detector, bot-detection, mobile-detection
ember-useragent
An Ember addon for Fastboot-enabled UserAgent parsing via UAParser.js.
Stars: ✭ 34 (+41.67%)
Mutual labels:  device-detector, mobile-detection
device detector
Crystal shard for device detection by User-Agent string
Stars: ✭ 21 (-12.5%)
Mutual labels:  user-agent-parser
react-ua
📱React User Agent Component, Hook, and HOC. SSR-ready, full UT, using new React Context and Hooks API
Stars: ✭ 18 (-25%)
Mutual labels:  user-agent-parser
user-agent
User-Agent parser for Clojure
Stars: ✭ 24 (+0%)
Mutual labels:  user-agent-parser
puppeteer-botcheck
🕵‍♂ Bot detection tests for Puppeteer. Hide and seek!
Stars: ✭ 42 (+75%)
Mutual labels:  bot-detection
crawlerdetect
Golang module to detect bots and crawlers via the user agent
Stars: ✭ 22 (-8.33%)
Mutual labels:  bot-detection
Ua Parser Js
UAParser.js - Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment.
Stars: ✭ 6,421 (+26654.17%)
Mutual labels:  user-agent-parser
Bowser
a browser detector
Stars: ✭ 5,006 (+20758.33%)
Mutual labels:  user-agent-parser
uainfer
Infer the user agent from its User Agent string
Stars: ✭ 21 (-12.5%)
Mutual labels:  user-agent-parser
Deviice
Swift library to easily check the current device and some more info about it.
Stars: ✭ 51 (+112.5%)
Mutual labels:  device-detector
device-detector
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
Stars: ✭ 49 (+104.17%)
Mutual labels:  device-detector
BotD
Bot detection library that runs in the browser. Identify JavaScript bots, browser spoofing, virtual machines and much more.
Stars: ✭ 215 (+795.83%)
Mutual labels:  bot-detection
stealth
anti-bot-detection with rod
Stars: ✭ 78 (+225%)
Mutual labels:  bot-detection
Tracker
Laravel Stats Tracker
Stars: ✭ 2,638 (+10891.67%)
Mutual labels:  mobile-detection

Udger client for Java (data ver. 3)

Local parser is very fast and accurate useragent string detection solution. Enables developers to locally install and integrate a highly-scalable product. We provide the detection of the devices (personal computer, tablet, Smart TV, Game console etc.), operating system and client SW type (browser, e-mail client etc.). It also provides information about IP addresses (Public proxies, VPN services, Tor exit nodes, Fake crawlers, Web scrapers .. etc.)

  • Tested with more the 50.000 unique user agents.
  • Up to date data provided by https://udger.com/
  • Support for >=Java6

Performance

Udger java parser uses LRU cache for last N requests. The size of cache can be defined in constructor, default size is 10000 requests. Parser's performance is tuned continuously, currently it reaches following rates:

  • 100.000 requests per second if LRU is hitted

  • 2.000 requests per second without caching

Using the in memory DB option will even make it faster.

Compile from git repo

    $ git clone https://github.com/udger/udger-java
    $ cd udger-java/
    $ maven package

Requirements

Udger data is stored in SQLite database file. Udger-java connects to SqLite using JDBC driver. SQLiteJDBC jdbc driver is recommended. If you are using Maven2, add the following XML fragments into your pom.xml file:

    <dependency>
      <groupId>org.xerial</groupId>
      <artifactId>sqlite-jdbc</artifactId>
      <version>3.8.11.2</version>
    </dependency>

Usage

How to Specify Udger Database

Example how to create UdgerParser from udger db file C:\work\udgerdb_v3.dat (in Windows)

    UdgerParser.ParserDbData parserDbData = new UdgerParser.ParserDbData("C:/work/udgerdb_v3.dat");
    UdgerParser up = = new UdgerParser(parserDbData);
    ...
    up.close();

and from a UNIX (Linux, Mac OS X, etc) udger db file /home/john/work/udgerdb_v3.dat

    UdgerParser.ParserDbData parserDbData = new UdgerParser.ParserDbData("/home/john/work/udgerdb_v3.dat");
    UdgerParser up = = new UdgerParser(parserDbData);
    ...
    up.close();

UdgerParser implements Closeable interface, therefore it must be either opened in try (...) statement or explicitly closed. Since the SQLite connection creating is time consuming task, it is recommended to keep the UdgerParser's instances in an instance pool. UdgerParser is not thread safe object, therefore it can't be used from multiple thread simultaneously.

Intention of class UdgerParser.ParserDbData is to keep precalculated DB-specific data and then improve instantiation of UdgerParser. Using UdgerParser.ParserDbData the Udger database can be switched in runtime.

How to make use of In Memory feature

The Udger client supports the SQLite DB transactions with the database being in memory. Enabling this feature will make the parser even faster to parse the user agents. Internally the client will re-create the Udger SQLite database from the file into the systems main memory and perform all transactions to it. Since this will require additional memory for operation, it needs to be used carefully with object pools. During pooling with multiple parsers in the pool, this feature will create a separate in memory DB for each new parser and have a single connection to it. This will further allow more concurrency since all connections (from all pooled parsers) now have their own copy of the database. To enable in memory feature simply use the below constructor and pass inMemoryEnabled as true. The internal LRU cache can be used by setting a size > 0 or disabled by passing 0 for the third argument.

Example:

    UdgerParser.ParserDbData parserDbData = new UdgerParser.ParserDbData("/home/john/work/udgerdb_v3.dat");
    UdgerParser up = new UdgerParser(parserDbData, true, 10000);
    ...
    uo.close();

Usage with maven

<dependency>
    <groupId>org.udger.parser</groupId>
    <artifactId>udger-parser</artifactId>
    <version>1.1.1</version>
</dependency>

Sample.java

    public class Sample {
      public static void main(String[] args) {
        UdgerParser.ParserDbData parserDbData = new UdgerParser.ParserDbData("/home/john/work/udgerdb_v3.dat");
        try (UdgerParser up = new UdgerParser(parserDbData)) {
            UdgerUaResult uaRet = up.parseUa("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9");
            UdgerIpResult ipRet = up.parseIp("108.61.199.93");
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
      }
    }

Automatic updates download

Documentation for programmers

Author

The Udger.com Team ([email protected])

old v1 format

If you still use the previous format of the db (v1), you can use https://github.com/adhar1985/DIUASparser

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].