I'm getting this error running scrape-it into a Remix app with the blues stack, if I run my code isolated works perfect, any ideas?
Here the error
/home/rogant/dev/findcard/node_modules/iterate-object/lib/index.js:28
if (fn(obj[keys[i]], keys[i], obj) === false) {
^
TypeError: $ is not a function
at /home/rogant/dev/findcard/node_modules/scrape-it-core/lib/index.js:137:30
at iterateObject (/home/rogant/dev/findcard/node_modules/iterate-object/lib/index.js:28:17)
at handleDataObj (/home/rogant/dev/findcard/node_modules/scrape-it-core/lib/index.js:119:9)
at Function.module.exports [as scrapeHTML] (/home/rogant/dev/findcard/node_modules/scrape-it-core/lib/index.js:208:12)
at Request._callback (/home/rogant/dev/findcard/node_modules/scrape-it/lib/index.js:32:40)
at Request.self.callback (/home/rogant/dev/findcard/node_modules/request/request.js:185:22)
at Request.emit (node:events:390:28)
at Request.<anonymous> (/home/rogant/dev/findcard/node_modules/request/request.js:1154:10)
at Request.emit (node:events:390:28)
at PassThrough.<anonymous> (/home/rogant/dev/findcard/node_modules/request/request.js:1076:12)
ERROR: "dev:server" exited with 1.
Here my script
"use strict";
const scrapeIt = require("scrape-it");
export function getDracoCards(query) {
return scrapeIt(`https://dracostore.co/?s=rune&post_type=product&dgwt_wcas=1`, {
cards: {
listItem: "li.product",
data: {
name: "h2.woocommerce-loop-product__title",
foil: {
selector: ".ast-woo-product-category",
convert: (cat) => cat.toLowerCase().indexOf('foil') > -1,
},
price: {
selector: ".woocommerce-Price-amount",
convert: (price) => price.replace('$', '')
}
}
}
}).then((data) => {
console.log(data.data.cards)
})
}