GithubHelp home page GithubHelp logo

witnesslq / sparkstreaminghtmlparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thachngoctran/sparkstreaminghtmlparser

0.0 1.0 0.0 337 KB

Using Spark Streaming, visit multiple websites; for each site, extract text within one HTML tag based on ID.

HTML 1.22% Batchfile 0.25% Scala 98.52%

sparkstreaminghtmlparser's Introduction

Spark Streaming Html Parser

Using Spark Streaming, visit multiple websites; for each site, extract text within one HTML tag based on ID.

For example, visit "http://www.amazon.com/LG-D820-Unlocked-Certified-Refurbished/dp/B017ROJ2NC", locate one HTML tag satisfying id equaling "priceblock_ourprice", then simply extract its text. Similarly, another link "http://www.zappos.com/josef-seibel-ruth-03", then id "priceSlot", get the text within.

The main idea here is to write a Customized Receiver for Spark Streaming. To some extent, this is like a web-crawler.

Result

This is how things work out:

Stream Creation

Points of Improvement:

  • Use multi-threads for fetching the webpage (originally fetching consequentially). => Done! (3 threads)

  • Create a use-case for stateful streaming, thus, also checkpoint feature. => Done! (Keep the lowest prices ever encountered)

  • Create a use-case for window-based streaming.

  • Use multiple receivers.

  • Save data to secondary storage.

Software Environment:

  • Apache Spark v1.6.1

  • IntelliJ IDEA Community Edition 2016.1.2 (with Scala plugin)

  • Scala v2.10.5

  • Java SDK v1.8.0_92 64-bit

  • htmlcleaner-2.16

References:

  1. Spark Streaming Custom Receivers

  2. Spark Streaming Programming Guide

  3. Html Cleaner

sparkstreaminghtmlparser's People

Watchers

 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.