Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

newsbing

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newsbing

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

A gem to sanely interact with the News portion of the Bing API. Based on the search bing gem.

find the gem on rubygems.org

Installation

gem install newsbing

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

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

  • Bing News results are limited to 15 results at a time; this gem will use skip and top to get as many results as needed, note that for every 15 results your "top" parameter is, you Asure will "charge" you 1 API call.

Example: Interactive Ruby Shell

require the gem in your shell session

require 'newsbing'

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

puts bing_results[0]["Thumbnail"]["MediaUrl"] # puts url of thumbnail 

display the total number of rsults

puts bing_results[0]["ImageTotal"]

FAQs

Package last updated on 17 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc