npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hubot-search

v0.1.2

Published

An extendable Hubot script for querying several search engine services: Google Custom Search, and Bing Search API.

Downloads

8

Readme

hubot-search

Build Status devDependency Status

An extendable Hubot script for querying several search engine services: Google Custom Search, Azure Marketplace - Bing Search API v2, and Microsoft Cognitive Services - Bing Search API v5.

See src/search.coffee for full documentation.


Attention: Azure Marketplace "Bing Search" and "Bing Search Web Results Only" API (v2) offerings will end of life on December 15, 2016.

Currently by default, this script will use Azure Marketplace - Bing Search API v2, and the BING_SEARCH_API_KEY environment variable should be the v2 key (from Azure Marketplace).

Nevertheless, we strongly recommend that you use Microsoft Cognitive Services - Bing Search API v5 by setting USE_BING_V5 to true in the environment that is using this script, and ensuring the BING_SEARCH_API_KEY is the v5 key (from Cognitive Services).

USE_BING_V5 will not be necessary by 2017 when the v2 API is deprecated at end of life.

Installation via NPM

  1. Install the hubot-search module as a Hubot dependency by running:

    npm install --save hubot-search
  2. Enable the module by adding the hubot-search entry to your external-scripts.json file:

    [
        "hubot-search"
    ]
  3. Run your bot and see below for available config / commands

Configuration

Variable | Default | Description --- | --- | --- GOOGLE_API_KEY | N/A | A unique developer API key is required to use Google's Custom Search API GOOGLE_CUSTOM_SEARCH | N/A | The Google Custom Search engine identifier (the cx portion of the custom search engine URL) BING_SEARCH_API_KEY | N/A | The API key for performing Bing Search API queries MAX_SEARCH_RESULTS | 5 | The number of search results to return

Google Custom Search

The Google Custom Search command listener will not be registered if neither GOOGLE_API_KEY nor GOOGLE_CUSTOM_SEARCH environment variables are defined.

Create Google API Key

  1. Create a new API key: https://console.developers.google.com/apis/credentials
  2. Select "Server key" for the type. You may be required to create a new project, just follow the instructions
  3. Return to the "Overview", and locate "Custom Search API"
  4. Enable "Custom Search API"

Create Google Custom Search Engine

  1. Create a new Google Custom Search engine: https://cse.google.com/cse/create/new

  2. To search all websites, enter any web URL in (1), and complete the creation

  3. Edit your newly created search engine

  4. Set "Sites to search" to "Search the entire web but emphasize included sites", and delete the sites you have previously added

  5. Save, and export the variables:

    export GOOGLE_API_KEY="API KEY HERE"
    export GOOGLE_CUSTOM_SEARCH="ENGINE ID HERE"

Azure Marketplace - Bing Search API v2

The Bing Search API command listener will not be registered if BING_SEARCH_API_KEY is not defined.

  1. Visit https://datamarket.azure.com/dataset/bing/searchweb

  2. Subscribe for a "Bing Search API – Web Results Only" package / plan (free works fine)

  3. Obtain the primary account key (located at the top of the page under "Show")

  4. Export the API key:

    export BING_SEARCH_API_KEY="API KEY HERE"

Microsoft Cognitive Services - Bing Search API v5

The Bing Search API command listener will not be registered if BING_SEARCH_API_KEY is not defined.

  1. Visit https://www.microsoft.com/cognitive-services/en-us/subscriptions?productId=/products/56ec2de6bca1df083495c610

  2. Subscribe for a "Bing Web Search" package / plan (free works fine)

  3. Obtain the API key (located in the "Keys" column; click "Show")

  4. Export the API key:

    export BING_SEARCH_API_KEY="API KEY HERE"
    export USE_BING_V5="true"

Commands

Command | Listener ID | Description --- | --- | --- hubot <search|google> query | search.google | Queries Google Custom Search for query, and returns the first MAX_SEARCH_RESULTS results hubot bing query | search.bing | Queries Bing Search API for query, and returns the first MAX_SEARCH_RESULTS results

Sample Interaction

user1>> hubot search Elon Musk
hubot>> 1. Elon Musk - Wikipedia, the free encyclopedia: Elon Reeve Musk is a South African-born Canadian-American business magnate
, engineer, and investor. He is the founder, CEO and CTO of SpaceX; ... (https://en.wikipedia.org/wiki/Elon_Musk)
hubot>> ...