Created
May 2, 2019 14:53
-
-
Save sayanee/7d8eb304f133ea3c5a3007e830e09209 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var osmosis = require('osmosis') | |
var ingredient = 'Sodium Benzoate' | |
osmosis | |
.get('https://www.ewg.org/skindeep/search.php?query=' + ingredient + '&h=Search') | |
.find('#table-browse > tr[2]') | |
.set({ | |
'ingredient': 'td[2]', | |
'score': 'td[3] > div > div > a > img@src' | |
}) | |
.data(function(listing) { | |
console.log(listing.ingredient) | |
var paragraph = listing.score | |
var regex = /image\d/g | |
var found = paragraph.match(regex) | |
console.log('SCORE: ' + found[0].replace(/image/g,'')) | |
}) | |
// .log(console.log) | |
// .error(console.log) | |
// .debug(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment