Giter Club home page Giter Club logo

ralert's Introduction

ralert

Ralert is a simple Ruby gem for parsing Google News search queries programmatically.

Usage

First, require the gem.

require 'ralert'

or if you are using a Gemfile, append this line

gem 'ralert'

Instantiate a SearchOptions object. This is optional and if skipped, the default options wil be used instead.

Options = SearchOptions.new

options.literal = true      # Whether or not this should be a literal search, ie. BOTH keywords 
                            # need to be present in the order presented in the string.
                            # values: true, false
                            # default: false

options.sort_by = 'd'       # Sorts by date(d) instead of relevance.
                            # values: 'd', 'r'
                            # default: 'd'

options.date_range = 'd'    # Returns results from the specified time frame instead of 'all time'.
                            # values: 'h', 'd', 'w', 'm', 'y', 'all'
                            # default: 'w' (ie. one week)

options.safe = 'on'         # Uses the Google safe search feature.
                            # values: on, off
                            # default: off

options.mode = 'nws'        # Searches through the Google News module instead of the all inclusive search 
                            # module
                            # values: 'nws', 'all'
                            # default: 'nws'

Request a search with a set of keywords using the above options

search = Ralert.new("ruby gem", options)

or request a search with the default option array

search = Ralert.new("ruby gem")

The above will return the first 10 results from Google. In case you want more:

search = Ralert.new("ruby gem").next_results(4)

which will return the first 4 pages of results (if available). Using a big number here might result in performance issues.

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.