GithubHelp home page GithubHelp logo

url_scraper's Introduction

Url Scraper

Its a simple plugin for providing facebook style url scraper. Using url scraper you can convert any simple textarea into a smart textarea which auto detects url entered by users and fetches the content of the webpage and displays it on the page. This gem is built on top of gem ‘opengraph’ by Michael Bleigh. This gem uses the opengraph tags as well as uses meta, title and img tags (in case if opengraph tags are not present) to fetch information about a page.

Installation

Add to your gemfile

gem "url_scraper"

Paste this line in your application.js file

//= require jquery.scraper

Paste this line in your application.css file

*= require scraper

Add following to your routes

match '/scrape_url' => "UrlScraper#scrape", :via => :post

Using the plugin in a view

Create a text area or text field with id=“scrape_url” and that’s it.

Advanced Usage

require 'url_scraper'

movie = UrlScraper.fetch('http://www.rottentomatoes.com/m/1217700-kick_ass/')

movie.title # => 'Kick-Ass'
movie.movie? # => true
movie.image # => 'http://images.rottentomatoes.com/images/movie/custom/00/1217700.jpg'

If you try to fetch Open Graph information for a URL that doesn’t have any, the fetch method will return values for title tag and other meta tags specified on the page.

The UrlScraper::Object that is returned is just a Hash with accessors built into it, so you can examine what properties you’ve retrieved like so:

movie.keys # => ['type','image','title','url']

Pending list

1) Showing video on the page.

2) Giving developers an easy way to integrate with rails forms.

url_scraper's People

Contributors

akshayshinde avatar mbjacket81 avatar

Watchers

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