Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Text notifications from web scraping
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.md
example.js
narc.js
package.json
twilio.json.example

README.md

narc

var narc = require('./narc')

// Specify the configuration file,
// target page,
// and test function.

narc('./twilio.json', 'https://news.ycombinator.com', function ($) {

  // This example checks for polls on the front page of Hacker News.

  var poll_count = 0
  $('.title a').each(function (i, el) {
    if (/Poll: .*/.test($(el).text())) poll_count++
  })

  // If the notification shouldn't be sent, return false.
  // Otherwise, return the content of the notification.

  if (poll_count == 0) {
    return false
  } else {
    return "There are " + poll_count + " new Hacker News polls"
  }
})
Something went wrong with that request. Please try again.