I figure this sub may be interested in this. I wrote a Node.js script to search ELR for multiple keywords and show the recipes which contained every keyword. To use this you must have Node.js installed.
Instructions
-
Create a directory with the two files below in it.
-
Open a Node.js command shell and change to the directory you created.
-
Run 'npm install'
-
Run 'npm start'
The script will list the recipes which contained all search terms. To modify the search just edit the terms variable on line 6 and run again. It's not pretty but it works.
File #1: package.json
{
"name": "eltest",
"version": "1.0.0",
"description": "Multi-keyword search for e-liquid-recipes.com",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"async": "^1.5.0",
"lodash": "^3.0.0",
"x-ray": "^2.0.2"
}
}
File #2: app.js
var async = require('async');
var _ = require('lodash');
var Xray = require('x-ray');
var x = Xray();
var terms = ["papaya", "kiwi"];
var recipes = [];
async.each(terms, function (value, callback) {
x('http://e-liquid-recipes.com/list?q=' + value + '&exclsingle=1&sort=score&direction=desc', 'table.recipelist span.mlink', [{
'name': 'a',
'href': 'a@href'
}])
.paginate('a[rel="next"]@href')
.limit(10)
(function (err, data) {
if (err) return callback(err);
try {
recipes.push(data);
} catch (e) {
return callback(e);
}
callback();
})
}, function (err) {
if (err) console.error(err.message);
var duplicates = _.filter(_.flatten(recipes), function (value, index, collection) {
var equal = _.where(collection, { href: value['href'] });
return equal.length > 1;
})
console.log(_.uniq(duplicates, 'href'));
});
I just committed a patch to ELR so that it should now support multiple keywords :)
I didn't realize an ELR dev was active here...
Good work man.. ELR is the only calculator and recipe book I use. Extremely useful. I even disabled my adblocker at the domain level, which is rare for me.
Hi, I ran your script and working fine. however, it is finding all recipes having kiwi and papaya and not those having only this two flavor.
How can I improve your script?
The real question is why ECR doesn't do this automatically.
Even nicer would be to be able to input all the flavors you have in your profile and have an option to search for recipes that only have those flavors...
"My flavor stash" then "what can I make?". That'll be $5, please.
That doesn't show you recipes which maybe use 4 out of the 5 flavors in your stash and it doesn't allow for exploring recipes.
> That doesn't show you recipes which maybe use 4 out of the 5 flavors in your stash and it doesn't allow for exploring recipes.
What do you mean? "What can I make" will show you every recipe you can possibly make, with the flavors you have...
"Search by flavor stash" allows you to check off each flavor that has to be in the recipes, but they can contain flavors you don't have :)
I guess I should do search a bit better at some point ;D
It's been a while since i've used ELR other than browsing it's forum, but; I'm pretty damn sure that you've been able to do exactly that for a year, now.