Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bing-cli

scottbea5MIT0.2.4

Use Bing Search in the terminal via command line

bing, search, cli, shell

readme

bing-cli

Execute Bing Search queries from the terminal including Web, News, Related Search, AutoSuggest, and Images. Images are displayed as colorized-ASCII art or as inline images directly (if using iTerm2).

Note: This project is not affiliated with Microsoft Corporation

Join the chat at https://gitter.im/bing-cli/Lobby build status npm version License dependency Status devDependency Status

Installation

First, install GraphicsMagick to support the image search features GraphicsMagick. In Mac OS X, you can simply use Homebrew and do:

$ brew install graphicsmagick

Then, the Bing-CLI module is installed globally via npm:

$ npm install bing-cli -g

Usage

This package is meant to be used as a command-line tool.

$ bing <search query> [-c <n>]
$ bing image <query> [-full] [-unsafe] [-c <n>] [-type <imageType>] [-size <imageSize> [-bw] [-grey] [-pixels] [-blocks] [-bg <rgb>]]
$ bing images <query> [-unsafe] [-c <n>]
$ bing news
$ bing news <query>
$ bing related <query>
$ bing suggest <query>
$ bing -version

Examples

This package is meant to be used as a command-line tool.

$ bing puff the magic dragon
$ bing -c 3 "sql server on linux"
$ bing images famous people
$ bing image yosemite -full
$ bing image apple logo -size small -full -scale 0.5 -ascii -bw -invert
$ bing image hawaii -ascii -pixels
$ bing news
$ bing news politics
$ bing news azure aws google cloud
$ bing related apache spark
$ bing suggest gaussi
$ bing netscaler manual fileType:pdf
$ bing image homeaway.com logo -ascii -blocks -size medium -invert -scale 0.8

Example Screen Shot

Configuration

Subscribing to APIs

Bing-CLI requires API keys from Microsoft to work at scale. There is a trial set of API keys included with limited query quota that is enough for trying it out.

Sustained usage will require that you get your API keys, you will need to sign up for Microsoft Congnitive Services by creating a new account with an email, or by signing up with your GitHub or LinkedIn account. Once you do this, you can click on the Pricing link to subscribe to a free-tier of services (more than enough for personal use) for the following APIs:

  • Bing Web Search - Free
  • Bing Autosuggest - Free

Setting Environment Variables

Once you subscribe to each API, you can then click the Show link to reveal the API keys. Then copy these keys and put them in the exports for the .bash_profile (as mentioned above).

export BING_SEARCH_KEY=<your key here>
export BING_AUTOSUGGEST_KEY=<your key here>

Make sure to restart the shell or source .bash_profile (or other shell profile file) for the changes to take effect.

$ source ~/.bash_profile

Development

Testing

npm test

Bugs

Please report any bugs here.

Changelog

Available here.

License

MIT

changelog

v0.1.5

  • moved to the MIT license (from BSD-3)
  • adds coverage, dependency, and continuous integration checking
  • added a CHANGELOG.md for tracking changes
  • integrated with david-dm.org for dependency status
  • added an MIT License badge to README
  • added the NPM package version as a badge to README

v0.1.6

  • added support for environment variables for the API Keys
  • updated the README with details on how to get a free subscription to the Bing API

v0.1.7

  • added sample screen shots for usage
  • simplified the README instructions and added details for GraphicsMagick and Bing API

v0.1.8

  • minor bug fixes

v0.1.9

  • added support for new -type flag for image search: (gif, line, clipart, photo, product)
  • added support for new -size flag for image search: (small, medium, large, wallpaper, all)
  • added support for displaying the original content instead of a thumbail. Specify raw image with -full flag.

v0.2.0

  • added support for -bw and -grey flags for image search
  • added support for -ascii flag for image search to force display of image as ascii
  • added new ASCII render modes with -pixels and -blocks
  • added new ASCII background color option with -bg <rgb>
  • added new ASCII image inversion with -invert
  • added a -version flag to show the version number of the app

v0.2.1

  • updated the sample API keys to make it work out of the box

v0.2.2

  • minor bux fix

v0.2.3

  • added suppport for image queries based on -aspect
  • added support for image queries based on -content
  • fixed a bug with the news query to show the redirect url instead of the internal (API) url

v0.2.4

  • updated the Azure keys (free-tier, limited usage)
  • migrated to v7 (from v5) of Bing Search API and Autosuggest
  • implemented a new "entity" search using the Microsoft Cognitive Services Entity Search