Skip to content

gem to use the bing search api, updated to take advantage of the recent migration to microsoft azure marketplace.

Notifications You must be signed in to change notification settings

dcheung/searchbing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

searchbing Build Status Gem Version

Puffin

A gem for the Bing Search API 2.0.

find the gem on rubygems.org

Installation

gem install searchbing

Configuration

An account key is needed to use the Bing Search API. You can create a new account for the Bing Search API and obtain account key here

Usage

  • valid search types include: Image, Web, News or Video. The first letter must be capitalized

  • this gem relies on the open-uri, net/http, and json gems.

Example: Interactive Ruby Shell

require the gem in your shell session

require 'searchbing'

create a new search object, below 10 results are requested, you can retrieve up to 50 at a time

bing_image = Bing.new('your_account_key_goes_here', 10, 'Image')

retrieve the results for a given term

bing_results = bing_image.search("puffin")

or optionally specify an offset for your search, to start retrieving results from the starting point provided

bing_results = bing_image.search("puffin", 25)

parse the results(recent changes require parsing with symbols, also please note the data structure of the response coming from bing has also changed)

puts bing_results[0][:Image][0][:MediaUrl]

display the total number of results

puts bing_results[0]["ImageTotal"]

About

gem to use the bing search api, updated to take advantage of the recent migration to microsoft azure marketplace.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 55.0%
  • CSS 31.5%
  • Ruby 13.5%