Code Monkey home page Code Monkey logo

javascriptcrawler's Introduction

Getting Started

This project aims to crawl on a given search string and provide list of top 5 used most used javaScript.

  1. Read​ ​a​ ​string​ ​(search​ ​term)​ ​from​ ​standard​ ​input with minimal validation like null and size
  2. Get​ ​a​ ​Google​ ​result​ ​page​ ​for​ ​the​ ​search​ ​term
  3. Extract​ ​main​ ​result​ ​links​ ​from​ ​the​ ​page, it used [jSoup] (https://jsoup.org/) to process the search result in programmatic way
  4. it also downloads the Java scripts used in the above result with parsing the each page . this download is multi-threaded using forkAndJoin feature and number of thread is configurable , please see application.yml file
  5. To compare and find top 5 javascript from the downloaded javascript below algorithm is used

How to Build

mvn clean install

##Run cd target

java -jar webcrawlerjs-0.0.1-SNAPSHOT.jar

or

Use Eclipse/IntelliJ SpringBoot Main Application Runner

Alogorithm to find top 5 most used javascript

input: List of JavaScriptObjects[ JavaScriptFile ]

output: print all Number of time javascript is used and its details

1. Generate 'sha` with google guava Api[Pleas see refeence link below]   
2. create a custom list of JavaScript objects **Look for class JavaScriptDetails**  which has FileName,`sha` value, and Souce location
3. Create a Map with Key : HashValue Value: Collection of Javascripts objects whcih has same `sha`
 Map<String,List<JavaScriptDetails>>
4. now sort in reverse order the Map with custome comparator which sort values equal to size of above which looks like List<Map.Entry<String, Integer> >
5. colllect the 1st 5 'sha' from the List
6. Iterate through teh above list and match the hash against Map in step 3 and print all the information along with list size

Reference Documentation

For further reference, please consider the following sections:

javascriptcrawler's People

Contributors

contacttapan avatar

Watchers

James Cloos 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.