Socket
Socket
Sign inDemoInstall

berlin.yuna:paginator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

berlin.yuna:paginator

Small browser service [needs chrome to be installed on the machine]


Version published
Maintainers
1
Source

Paginator

Paginator to get html documents with JS support

Build Maintainable Coverage Issues Commit Dependencies License Central Tag Javadoc Size Label Label

Requirements

  • min java 8
  • chrome installed on the machine

Docker image

Configurations

ENV VARIABLEDEFAULTDESCRIPTION
SERVER_PORT8089Server port
N/A10000HTML pages cache limit
N/A10800000msHTML pages cache life time

Endpoints

METHODURLREQUEST BODYRETURN BODYDescription
GET/PUT/pagesurl,
page_cache_ms* [optional]
Get html page from url
GET/PUT/pages/elementsurl,
Map<queryId, cssQuery>,
page_cache_ms* [optional]
Map<queryId,
List<Elements>>
Get specific html elements
GET/PUT/pagesurl,
content,
page_cache_ms* [optional]
Manual add html page to cache
GET/PUT/pages/statisticssize,
maxLifeTime,
sizeLimit
Get cache statistics

* page_cache_ms is optional - it does not overwrite the previous value at the second call.

Examples

Get elements from HTML page
  • Request: GET http://localhost:8089/pages/elements
  • Body:
{
  "url": "parse.example.com",
  "css_queries": {
    "form_text": "form p"
  }
}
  • Response
{
  "form_text": [
    {
      "tag": "P",
      "text": "Some example text here.",
      "selector": "html > body > div > form > p:nth-child(1)",
      "attributes": {
      },
      "children": [
      ]
    }
  ]
}
Cache custom html pages
  • Request: POST http://localhost:8089/pages
  • Body:
{
  "url": "my.own.example.com",
  "content": "<!doctype html><html><head><title>Example Domain</title></head><body><div><h1>Example page</h1></div></body></html>"
}
  • Request: POST http://localhost:8089/pages
  • Body:
{
  "url": "my.own.example.com",
  "content": "<!doctype html><html><head><title>Example Domain</title></head><body><div><h1>Example page</h1></div></body></html>"
}

Docker build image example

  • Create jar file: mvn clean -Dmaven.test.skip=true package
  • Build local image docker build -t paginator .
  • Docker image tag latest for repo: docker tag "$(whoami)/paginator" SOME_REPO_PATH/paginator:latest;
  • Docker image push to repo: docker push SOME_REPO_PATH/paginator:latest

TODO

  • Async page call implementation [remove synchronised]
  • Endpoint to clear cache
  • configurable default cache limits
    ////((((((((((((((((((((((((((((((* **         
    //////////////////////////////////* */(/.      
    //////////////////////////////////* */////*    
    //////////////////////////////////* *////////. 
    //////////////////////////////////*            
    ///////......................,////////////////.
    //////////////////////////////////////////////.
    ///////...............................,///////.
    ///////******************************/////////.
    //////////////////////////////////////////////.
    //////*.           PAGINATOR          ,///////.
    //////////////////////////////////////////////.
    **********************************************.
    **********************************************.
    ********,....*********************************.
    ********,    *********************************.
            .,***********,    ,*******************.
             ,,,,,,,,,,,,,    ,*,,,,,      .,,,,,,.
             ,,,,,,,,,    ,,,,,,,,,,,      .,,,,,,.
      ................    .......,,,.   .......... 
      ,,,,,,.                    ,,,.  .,,,.       
      ,,,,,,.       ....     ,,,.                  
                    ,,,.     ,,,.                  
                ....                               
                ....                               
                    ....                           

FAQs

Package last updated on 21 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc