dynfetcher
Simple class for fetching parts of web pages using CSS selectors.
Last updated 8 years ago .
Original npm · Tarball · package.json
$ cnpm install dynfetcher 
SYNC missed versions from official npm registry.

Dynfetcher-node

Build Status

DynFetcher is a simple library for fetching parts of web pages using CSS selectors.

Fetch weather or TV program or any other data from (X)HTML files in just a few lines using CSS selectors.

Example

DynFetcher = require '../lib/'

url = 'http://www.wunderground.com/weather-forecast/LJ/Maribor.html'
dyn = new DynFetcher url

itemData = 
    day :
        selector : '.titleSubtle'
        required : on
    min :
        selector : '.foreSummary'
        process  : (data) -> data.trim()
        required : on
    max :
        selector : '.foreSummary > span',

itemProcessFn = (item) ->
    if item.min?
        item.min = item.min.replace /\D+/g, ''
        if item.min.length
            item.min = parseInt item.min, 10
        else
            delete item.min

    if item.max?
        item.max = parseInt item.max, 10

    item

dyn.find 'div.foreGlance', itemData, itemProcessFn, (err, weather) ->
    if err
        console.error err
        return

    console.log weather

For latest updates visit project's repository.

Maybe you might find interesting Yahoo! Query Language.

Current Tags

  • 0.2.0                                ...           latest (8 years ago)

2 Versions

  • 0.2.0                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |