Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ recipeScraper("some.recipe.url").then(recipe => {
- https://www.thespruceeats.com/
- https://whatsgabycooking.com/
- https://www.woolworths.com.au/
- https://www.yellowblissroad.com/
- https://www.yummly.com/
- https://www.jamieoliver.com/

Expand Down
1 change: 1 addition & 0 deletions helpers/ScraperFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const domains = {
thespruceeats: require("../scrapers/TheSpruceEatsScraper"),
whatsgabycooking: require("../scrapers/WhatsGabyCookingScraper"),
woolworths: require("../scrapers/WoolworthsScraper"),
yellowblissroad: require("../scrapers/YellowBlissRoadScraper"),
yummly: require("../scrapers/YummlyScraper"),
jamieoliver: require("../scrapers/JamieOliverScraper")
};
Expand Down
52 changes: 52 additions & 0 deletions scrapers/YellowBlissRoadScraper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"use strict";

const BaseScraper = require("../helpers/BaseScraper");

class YellowBlissRoadScraper extends BaseScraper {
constructor(url) {
super(url, "yellowblissroad.com/");
}

scrape($) {
this.defaultSetImage($);
this.defaultSetDescription($);
this.recipe.name = $(".wprm-recipe-name").text();
const { ingredients, instructions, time } = this.recipe;

$(".wprm-recipe-ingredient").each((i, el) => {
let amount = $(el)
.find(".wprm-recipe-ingredient-amount")
.text();
let unit = $(el)
.find(".wprm-recipe-ingredient-unit")
.text();
let name = $(el)
.find(".wprm-recipe-ingredient-name")
.text();
let ingredient = `${amount} ${unit} ${name}`
.replace(/\s\s+/g, " ")
.trim();
ingredients.push(ingredient);
});

$(".wprm-recipe-instruction").each((i, el) => {
instructions.push(this.textTrim($(el)));
});

time.prep =
`${$(".wprm-recipe-prep_time").text()} ${$(
".wprm-recipe-prep_time-unit"
).text()}` || "";
time.cook =
`${$(".wprm-recipe-cook_time").text()} ${$(
".wprm-recipe-cook_time-unit"
).text()}` || "";
time.total =
`${$(".wprm-recipe-total_time").text()} ${$(
".wprm-recipe-total_time-unit"
).text()}` || "";
this.recipe.servings = $(".wprm-recipe-servings").text() || "";
}
}

module.exports = YellowBlissRoadScraper;
40 changes: 40 additions & 0 deletions test/constants/yellowblissroadConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
testUrl:
"https://www.yellowblissroad.com/cranberry-brie-bites/",
invalidUrl: "https://www.yellowblissroad.com/notarealurl",
invalidDomainUrl: "www.invalid.com",
nonRecipeUrl: "https://www.yellowblissroad.com/about/",
expectedRecipe: {
name: 'Cranberry Brie Bites',
description: 'Cranberry Brie Bites are a sweet and tangy bite-sized appetizer. Creamy brie cheese in a flaky crescent roll cup topped with cranberry sauce.',
ingredients: [
'8 ounce tube crescent roll dough',
'flour for rolling out the dough',
'6 ounces Brie cheese',
'¼ cup orange marmalade',
'¼ cup whole cranberry sauce',
'¼ cup chopped pistachios, pecans or walnuts',
'fresh rosemary or candied orange pieces for garnish'
],
instructions: [
'Preheat oven to 375 degrees F and grease a 24-count mini-muffin pan with nonstick cooking spray.',
'Cut the brie into small, about 1-inch (or a little less) squares and set aside in the refrigerator until ready to use.',
'In a small bowl, mix together orange marmalade and cranberry sauce. Set aside.',
'Lightly flour a flat surface, like a large wooden cutting board, and roll out the tub of crescent dough. Stretch slightly to form an evenly sided rectangle and pinch seams together. Cut into 24 even sized squares.',
'Place the squares into the prepared muffin cups. Top with brie cheese square and a teaspoon (or a little less) of the orange-cranberry mixture. Top with a few of the chopped nuts and a small sprig of rosemary.',
'Slide the muffin pan into the oven and bake for about 10-13 minutes, or until golden brown and dough is cooked through.',
'Let cool 5-10 minutes and serve warm.'
],
tags: [],
time: {
prep: '15 minutes mins',
cook: '13 minutes mins',
active: '',
inactive: '',
ready: '',
total: '28 minutes mins'
},
servings: '8',
image: 'https://www.yellowblissroad.com/wp-content/uploads/2019/11/Cranberry-Brie-Bites-9.jpg'
}
};
5 changes: 5 additions & 0 deletions test/yellowblisskitchen.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";
const commonRecipeTest = require("./helpers/commonRecipeTest");
const constants = require("./constants/yellowblissroadConstants");

commonRecipeTest("yellowblissroad", constants, "yellowblissroad.com/");