kickstarter-crawler
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -186,4 +186,10 @@ const cheerio = require('cheerio'); | ||
backers = backers[0] && backers[0].replace(/[^0-9]/g, ''); | ||
// adjust for edge case for unavailable rewards | ||
backers = | ||
'Reward no longer available' === backers[0] ? | ||
backers[1] : | ||
backers[0]; | ||
backers = backers && backers.replace(/[^0-9]/g, ''); | ||
pledges.push([Number(amount), Number(backers)]); | ||
@@ -190,0 +196,0 @@ } |
@@ -5,4 +5,4 @@ const kickstarterCrawler = require('./index'); | ||
describe('kickstarter-crawler test suite', () => { | ||
it('should return specific payload', () => { | ||
describe('Project: CLASSIC LEGACY', () => { | ||
it('should return without errors', () => { | ||
const url = 'https://www.kickstarter.com/projects/maxtemkin/philosophy-posters'; | ||
@@ -31,1 +31,36 @@ let result = kickstarterCrawler(url); | ||
}); | ||
describe('Project: REWARD NOT AVAILABLE', () => { | ||
it('should return pledges[amount, backer] without errors', () => { | ||
const url = 'https://www.kickstarter.com/projects/jeffrichards/tesla-vs-cthulhu-the-nightmare-of-desolation-sound/'; | ||
let result = kickstarterCrawler(url); | ||
result.then((data) => { | ||
assert.deepStrictEqual(data, { | ||
title: 'Tesla vs Cthulhu - The Nightmare of Desolation Sound', | ||
creator: 'Jeff Richards', | ||
description: "Nikola Tesla, the greatest inventor in history, faces off against the nightmarish creatures of H.P. Lovecraft's Cthulhu Mythos!", | ||
category: 'Shorts', | ||
location: [ 'Vancouver', 'Canada' ], | ||
duration: 32, | ||
startdate: 'Sep 9, 2013', | ||
enddate: 'Oct 12, 2013', | ||
funding: 9901, | ||
goal: 8500, | ||
backers: 164, | ||
pledges: [ | ||
[ 1, 11 ], [ 5, 9 ], | ||
[ 10, 15 ], [ 25, 72 ], | ||
[ 50, 18 ], [ 100, 6 ], | ||
[ 100, 0 ], [ 150, 9 ], | ||
[ 200, 2 ], [ 250, 2 ], | ||
[ 250, 1 ], [ 250, 0 ], | ||
[ 500, 1 ], [ 750, 0 ], | ||
[ 1000, 1 ], [ 50, 1 ] | ||
], | ||
thumbnail: 'https://ksr-ugc.imgix.net/assets/011/559/706/db220c1c78da500e0cbde7eb5a3fb007_original.png?ixlib=rb-2.1.0&crop=faces&w=1552&h=873&fit=crop&v=1463684471&auto=format&frame=1&q=92&s=9f45aaac948be84947d7123750d2a2ed', | ||
project_url: 'https://kickstarter.com/projects/jeffrichards/tesla-vs-cthulhu-the-nightmare-of-desolation-sound', | ||
videoDuration: '01:22' | ||
}); | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "kickstarter-crawler", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Kickstarter crawler that does what you think it would", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
9731
241