farm-invest-cli
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "farm-invest-cli", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Are there new investment opportunities on FarmCrowdy, ThriveAgric or EFarms?", | ||
@@ -5,0 +5,0 @@ "main": "src/farm-invest-cli.js", |
@@ -8,3 +8,3 @@ const { default : axios } = require('axios') | ||
module.exports = function () { | ||
return axios.get('https://www.efarms.com.ng/index.php').then(res => { | ||
return axios.get('https://www.efarms.com.ng/index.php/en/farms').then(res => { | ||
const $ = cheerio.load(res.data) | ||
@@ -14,12 +14,12 @@ | ||
const activeProducts = $('#services div.media.services-wrap') | ||
const activeProducts = $('section.causes div.grid') | ||
const productList = activeProducts.map(function () { | ||
const title = $(this).find('h3.media-heading').text().trim() | ||
const [ address, price, returns ] = $(this).find('h4.media-heading').map(function () { | ||
return $(this).text().trim() | ||
}).toArray() | ||
const link = $(this).parentsUntil('a').parent().attr('href').trim() | ||
return { title, price, link, returns, address } | ||
}).toArray() | ||
const title = $(this).find('h3 a').text().trim() | ||
const price = $(this).find('div.raised').text().trim(); | ||
const returns = $(this).find('div.goal').text().trim(); | ||
const daysLeft = $(this).find('span.remaining-days').text().trim(); | ||
const link = $(this).find('h3 a').attr('href').trim() | ||
return { title, price, link, returns, daysLeft, farm: 'efarms' } | ||
}).toArray().filter(({ daysLeft }) => daysLeft && !daysLeft.endsWith('ago')) | ||
@@ -26,0 +26,0 @@ return productList |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22540