Created
February 8, 2017 13:22
-
-
Save kandebonfim/014158da687388c229ca7ab696a059f3 to your computer and use it in GitHub Desktop.
Scrapping catarse website.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var allCards = document.querySelectorAll('.card-project') | |
var cards = []; | |
allCards.forEach( function(element, index) { | |
var currElem = {} | |
var name = element.querySelector('.link-hidden') | |
var author = element.querySelector('.w-hidden-small.w-hidden-tiny.fontsize-smallest.fontcolor-secondary.u-marginbottom-20') | |
var description = element.querySelector('.w-hidden-small.w-hidden-tiny.fontcolor-secondary.fontsize-smaller .link-hidden') | |
var percentage = element.querySelector('.card-project-stats .fontsize-base.fontweight-semibold') | |
var money = element.querySelector('.card-project-stats .fontsize-smaller.fontweight-semibold') | |
currElem.name = name.innerText; | |
currElem.author = author.innerText; | |
currElem.description = description.innerText; | |
currElem.percentage = parseInt(percentage.innerText.replace('%', '')); | |
currElem.money = parseFloat(money.innerText.replace('R$ ', '')) * 1000; | |
currElem.askedMoney = (100 * currElem.money) / currElem.percentage; | |
currElem.founded = currElem.percentage >= 100 ? true : false; | |
cards.push(currElem); | |
}); | |
console.log(cards); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment