Git Product home page Git Product logo

html-parser-api's Introduction

HTML parser API app

It's a sample application to parse HTML file using API call.

  • Ruby version >=2.4.1
$ ruby -version
  • Rails version >=5.2.0
$ rails -v
  • System dependencies

  • Configuration[save follow file as database.yml and update configuration as needed]

config/database.example.yml 
  • Database creation
$ rake db:create
  • Database initialization
$ bundle exec rake db:schema:load
$ bundle exee rake db:test:prepare
  • Run server
$ bundle exec rails s
  • How to run the test suite
$ bundle exec rspec
  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

API uses example

1. Parse a web page[it will parse all content with tag h1, h2, h3 and a]

Request

http://localhost:3000/contents/parse?ref_url=http://getbootstrap.com

Response

{"success":true,"code":200,"message":"OK"}

2. Fetch list of matched content [it will fetch all of the parsed content]

Request

http://localhost:3000/contents

Response

{"data":[{"id":"1","type":"contents","links":{"self":"http://localhost:3000/contents/1"},"attributes":{"url":"http://getbootstrap.com","tag":"h1","content":"Bootstrap"}},{"id":"2","type":"contents","links":{"self":"http://localhost:3000/contents/2"},"attributes":{"url":"http://getbootstrap.com","tag":"h3","content":"Installation"}},{"id":"3","type":"contents","links":{"self":"http://localhost:3000/contents/3"},"attributes":{"url":"http://getbootstrap.com","tag":"h3","content":"BootstrapCDN"}},{"id":"4","type":"contents","links":{"self":"http://localhost:3000/contents/4"},"attributes":{"url":"http://getbootstrap.com","tag":"h3","content":"Official Themes"}},{"id":"5","type":"contents","links":{"self":"http://localhost:3000/contents/5"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Bootstrap\n"}},{"id":"6","type":"contents","links":{"self":"http://localhost:3000/contents/6"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Home"}},{"id":"7","type":"contents","links":{"self":"http://localhost:3000/contents/7"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Documentation"}},{"id":"8","type":"contents","links":{"self":"http://localhost:3000/contents/8"},"attributes":{"url":"http://getbootstrap.com","tag":"a","content":"Examples"}}]}

html-parser-api's People

Contributors

masudcsesust04 avatar

Stargazers

 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.