medialab / artoo

artoo.js - the client-side scraping companion.
http://medialab.github.io/artoo/
MIT License
1.1k stars 93 forks source link

Subselecting within a configObject using Artoo #287

Closed adriangith closed 5 years ago

adriangith commented 5 years ago

Using Artoo, I'm trying to iterate through all the span elements but only get the content from a span that matches a specific id or class.

The code below will return the content of all the span elements. In this specific case I only want the content of a span that has the id: #NoticeInfo_lblVrmNo.

var scraper = {
    iterator: 'span',
    scrape: {
        data: {
            InfringementNo: '#NoticeInfo_lblVrmNo'
            }  
      }
}   

artoo.ajaxSpider(['https://djr.view.civicaclou...ails.aspx'], {
        scrape: scraper,
        concat: true,
        done: function(data) {
            console.log('Retrieved data:', data)
          }
        }
    )